A plugin for Inquirer, adding validation, default to the confirm prompt.
Basically a regular confirm with regular options of prompt implemented.
npm :
npm i inquirer-confirm-extra
yarn :
yarn add inquirer-confirm-extra
validate (Function) : Function for validation same as normal prompt validation function
defaultValue (Boolean | true) : Default value for prompt
showDefault (Boolean | true) : show default value with question
inquirer.registerPrompt('confirm-extra', require('inquirer-confirm-extra'));
inquirer.prompt({
type: 'confirm-extra',
defaultValue: false,
validate(val, answers) {
if (!val) {
return "Sorry, We can't do that";
}
return true;
},
...
});
This package is built upon existing package inquirer-confirm-validated, it's good except it only has validation implemented.
It also hasn't been updated since 2 years and there was no repo link or I would have sent PR.
(MIT)
Feel free to send PR for adding extra options or if you wants to add tests.