npm.io
0.2.2 • Published 10 years ago

enquirer-prompt-checkbox

Licence
MIT
Version
0.2.2
Deps
5
Vulns
0
Weekly
0
Stars
22
DeprecatedThis package is deprecated

enquirer-prompt-checkbox NPM version NPM downloads

Adds multiple-choice/checkbox prompt support to Enquirer.

checkbox prompt example

Install

Install with npm:

$ npm install --save enquirer-prompt-checkbox

Usage

var Enquirer = require('enquirer');
var enquirer = new Enquirer();

enquirer.register('checkbox', require('enquirer-prompt-checkbox'));

Example

Enquirer supports both the declarative inquirer-style question format and a functional format using the .question method:

.question

Functional style questions.

var Enquirer = require('enquirer');
var enquirer = new Enquirer();

enquirer.register('checkbox', require('enquirer-prompt-checkbox'));
enquirer.question('color', 'What is your favorite color?', {
  type: 'checkbox',
  default: 'blue',
  choices: ['red', 'yellow', 'blue']
});

enquirer.ask('color')
  .then(function(answers) {
    console.log(answers)
  });

Inquirer-style questions

Declarative questions format.

var Enquirer = require('enquirer');
var enquirer = new Enquirer();

enquirer.register('checkbox', require('enquirer-prompt-checkbox'));

var questions = [
  {
    name: 'color',
    message: 'What is your favorite color?',
    type: 'checkbox',
    default: 'blue',
    choices: ['red', 'yellow', 'blue']
  }
];

enquirer.ask(questions)
  .then(function(answers) {
    console.log(answers)
  });

Attribution

Based on the checkbox prompt in inquirer.

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running tests

Install dev dependencies:

$ npm install -d && npm test
Author

Jon Schlinkert

License

Copyright 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb-generate-readme, v0.1.30, on August 30, 2016.

Keywords