inquirer-multi-choice
v0.0.1
Published
A multiple choice prompt for Inquirer
Downloads
1,412
Readme
inquirer-multi-choice
A multiple choice prompt for Inquirer.js
Installation
npm install --save inquirer-multi-choice
Usage
After registering the prompt, set any question to have type: "mutli-choice"
to make use of this prompt.
The result will be an array, containing the value for each row.
inquirer.registerPrompt('multi-choice', require('inquirer-multi-choice'));
inquirer
.prompt([
{
type: 'multi-choice',
name: 'settings',
message: 'Change settings',
rows: [
{
name: 'Enabled',
choices: ['on', 'off'],
},
{
name: 'Color',
choices: [
{
name: 'red',
value: '#f00',
},
{
name: 'green',
value: '#0f0',
},
{
name: 'blue',
value: '#00f',
},
],
},
{
name: 'Log',
default: 'false',
choices: ['true', 'false'],
},
],
},
])
.then((answers) => {
console.log(answers);
/*
{
settings: {
Enabled: 'on',
Color: 'red',
Log: 'true'
}
}
*/
});
Options
rows
: Array of objects. Follows the same format as Inquirer'schoices