inquirer-confirm-extra

1.0.1 • Public • Published

Inquirer confirm with extras

A plugin for Inquirer, adding validation, default to the confirm prompt.

Basically a regular confirm with regular options of prompt implemented.

Options

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

Example Usage

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;
  },
  ...
});

Inspiration

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.

License

(MIT)

Contribution

Feel free to send PR for adding extra options or if you wants to add tests.

Package Sidebar

Install

npm i inquirer-confirm-extra

Weekly Downloads

5

Version

1.0.1

License

ISC

Unpacked Size

6.61 kB

Total Files

6

Last publish

Collaborators

  • pankajvaghela