Napping Peanut Monsters

npm

Need private packages and team management tools?Check out npm Orgs. »

choices

0.1.3 • Public • Published

Choices

Choices is an API for prompting the user with multiple-choices.

Choices are displayed in a numbered list, user is prompted with a message and options repeatedly until they make a choice or cancel (q, esc, ctrl+c).

If the user cancels, your callback will receive null as the option index.

Install

npm install choices

Example

var choices = require('choices');
var options = ['First Option', 'Second option', 'Third option'];
choices('Pick an option', options, function(idx) {
  console.log('You picked ' + options[idx]);
});
  [1]: First option
  [2]: Second option
  [3]: Third option
Pick an option>> 2
You picked Second option

install

npm i choices

Downloadsweekly downloads

342

version

0.1.3

license

BSD

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability