New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

prompt-list

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prompt-list

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

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
decreased by-2.33%
Maintainers
2
Weekly downloads
 
Created
Source

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

  • enquirer-prompt: Base prompt module used for creating custom prompt types for Enquirer. | homepage
  • enquirer-question: Question object, used by Enquirer and prompt plugins. | homepage
  • enquirer: Intuitive, plugin-based prompt system for node.js. Much faster and lighter alternative to Inquirer, with all… more | homepage

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.

Keywords

FAQs

Package last updated on 05 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc