Nietzsche's Preposterous Moustache

    enquirer-prompt-rawlist

    0.1.0 • Public • Published

    enquirer-prompt-rawlist NPM version NPM downloads

    Adds rawlist prompt support to Enquirer.

    rawlist prompt example

    Install

    Install with npm:

    $ npm install --save enquirer-prompt-rawlist

    Usage

    Functional style

    var Enquirer = require('enquirer');
    var enquirer = new Enquirer();
     
    enquirer.register('rawlist', require('enquirer-prompt-rawlist'));
     
    enquirer.question('dinner', 'What would you like to do?', {
      type: 'rawlist',
      choices: [
        'Order a pizza',
        'Make a reservation',
        enquirer.separator(),
        'Ask opening hours',
        'Talk to the receptionist'
      ]
    });
    enquirer.question('size', 'What size would you like?', {
      type: 'rawlist',
      choices: ['Jumbo', 'Large', 'Standard', 'Medium', 'Small', 'Micro']
    });
     
    enquirer.ask(['dinner', 'size'])
      .then(function (answers) {
        console.log(answers);
        //=> { dinner: 'Order a pizza', size: 'Large' }
      });

    Declarative style

    Define questions using a declarative style, like Inquirer.

    var Enquirer = require('enquirer');
    var enquirer = new Enquirer();
     
    enquirer.register('rawlist', require('enquirer-prompt-rawlist'));
     
    var questions = [
      {
        type: 'rawlist',
        name: 'dinner',
        message: 'What would you like to do?',
        choices: [
          'Order a pizza',
          'Make a reservation',
          enquirer.separator(),,
          'Ask opening hours',
          'Talk to the receptionist'
        ]
      },
      {
        type: 'rawlist',
        name: 'size',
        message: 'What size would you like?',
        choices: ['Jumbo', 'Large', 'Standard', 'Medium', 'Small', 'Micro']
      }
    ];
     
    enquirer.ask(questions)
      .then(function (answers) {
        console.log(answers);
      });

    Attribution

    Based on the rawlist prompt in inquirer.

    About

    Related projects

    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.

    Install

    npm i enquirer-prompt-rawlist

    DownloadsWeekly Downloads

    5

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • jonschlinkert