Inquirer.js: Loop list prompt

Created on 12 Jun 2013  路  4Comments  路  Source: SBoudrias/Inquirer.js

When hit down on the last item it should go to the first and when hitting up on the first item it should go to the last.

enhancement

Most helpful comment

Is there anyway we could get this as an option? Not all lists make sense for looping IMHO. I'm working with a list of the last X of something and I want it to be clear where the top/bottom of the list are. Related but not the same thing it would be nice to be able to determine the size/length of the displayed list.

All 4 comments

Is there anyway we could get this as an option? Not all lists make sense for looping IMHO. I'm working with a list of the last X of something and I want it to be clear where the top/bottom of the list are. Related but not the same thing it would be nice to be able to determine the size/length of the displayed list.

@joshstrange did you ever find a solution to disable the looping?

@sintaxi I didn't but I did put a new inquirer.Separator() on the top of my list to make it obvious you had looped:

const listOfOptions = [.....]; listOfOptions.unshift(new inquirer.Separator()); const boardPrompt = await inquirer.prompt([ { type: 'list', message: 'Select an option', name: 'option', choices: listOfOptions } ]);

Just want to say that I agree. I think this should have been made optional as I find it unintuitive to loop through a list. I added a separator at the _bottom_ of the list with:

listOfOptions.push(new inquirer.Separator( "-- End of List --" ));

But it really just shouldn't do this by default in the first place.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lvjiaxuan picture lvjiaxuan  路  6Comments

ro31337 picture ro31337  路  5Comments

mechanical-turk picture mechanical-turk  路  3Comments

adalinesimonian picture adalinesimonian  路  6Comments

apierzch picture apierzch  路  4Comments