Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rawlist - arrows doesn't work #1617

Open
td-krzysiek opened this issue Dec 6, 2024 · 4 comments
Open

rawlist - arrows doesn't work #1617

td-krzysiek opened this issue Dec 6, 2024 · 4 comments

Comments

@td-krzysiek
Copy link

Hello,

In the past rawlist supported up/down arrows to navigate through the options. Currently I can use arrows for 'select' but not for the 'rawlist'. Why this happens, please?

import { select, rawlist } from '@inquirer/prompts';

console.log(
  await select({
    message: 'Select a package manager',
    choices: [
      { name: 'npm', value: 'npm' },
      { name: 'yarn', value: 'yarn' },
      { name: 'pnpm', value: 'pnpm' },
    ],
  })
);

console.log(
  await rawlist({
    message: 'Select a package manager',
    choices: [
      { name: 'npm', value: 'npm' },
      { name: 'yarn', value: 'yarn' },
      { name: 'pnpm', value: 'pnpm' },
    ],
  })
);
image
@SBoudrias
Copy link
Owner

Hey @td-krzysiek, why not using a select if you want it to be navigable by arrow?

I didn't know/remember arrows were working previously, I'm not against re-adding it, but I think overall the select will just be a better experience.

@td-krzysiek
Copy link
Author

Hi @SBoudrias, in my use case, I have a menu where most levels have just a few entries, but some options display, say, 15 entries. People usually navigate using arrows, but when many entries appear on the list, it is more convenient to enter a number (unless the option is close to the top or bottom of the list).

In worked in inquirer@9:

image

To reproduce:

npm init -y
npm i inquirer@9

main.mjs:

import inquirer from 'inquirer'

inquirer.prompt([
  {
    name: 'question',
    type: 'rawlist',
    choices: [
      { name: 'abc' },
      { name: 'bcd' }
    ]
  }
]);

@SBoudrias
Copy link
Owner

@td-krzysiek the latest select (either in inquirer or @inquirer/prompts or @inquirer/select) does select the input name you typed; which makes it more convenient than the one from v9.

@td-krzysiek
Copy link
Author

Thank you, for a time being we will consider using select but with numeric keyboard it is more convenient to type numbers for larger lists, so rawlist from v9 was ideal for our use case :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants