Ordinal prompt for inquirer
npm install --save inquirer inquirer-ordinal-prompt
inquirer.registerPrompt('ordinal', require('inquirer-ordinal-prompt').default);
inquirer.prompt({
type: 'ordinal',
name: 'scripts',
message: 'Pick scripts to run in order',
choices: [ 'Build', 'Lint', 'Test' ],
default: [ 'Build' ]
});
Take type
, name
, message
, choices
[, filter
, validate
, default
] properties.
default
is expected to be an Array of the ordered choices value.
ordinal prompt is mostly the same as checkbox prompt, with slight differences:
- it doesn't use
checked
property and instead leveragesdefault
as an ordered list of choice values. - selecting a choice will show ordinal index instead of filled checkbox.
You can find a running example in demo.js