JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15800
  • Score
    100M100P100Q129439F
  • License MIT

List-style prompt. Can be used as a standalone prompt, or with a prompt system like [enquirer].

Package Exports

  • prompt-list

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prompt-list) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

prompt-list NPM version NPM monthly downloads NPM total downloads Linux Build Status

List-style prompt. Can be used as a standalone prompt, or with a prompt system like enquirer.

prompt-list example

Install

Install with npm:

$ npm install --save prompt-list

Example usage

var List = require('prompt-list');
var list = new List({
  type: 'list',
  name: 'order',
  message: 'What would you like to order?',
  choices: [
    'Coke',
    'Diet Coke',
    'Cherry Coke',
    {
      name: 'Sprite',
      disabled: 'Temporarily unavailable'
    },
    'Water'
  ]
});

// promise
list.run()
  .then(function(answer) {
    console.log(answer);
  });

// or async
list.ask(function(answer) {
  console.log(answer);
});

Enquirer usage

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

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

var questions = [
  {
    type: 'list',
    name: 'order',
    message: 'What would you like to order?',
    choices: [
      'Coke',
      'Diet Coke',
      'Cherry Coke',
      {
        name: 'Sprite',
        disabled: 'Temporarily unavailable'
      },
      'Water'
    ]
  }
];

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

Attribution

Based on the list prompt in inquirer.

About

Contributing

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

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on May 05, 2017.