Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prompt-confirm

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prompt-confirm

Confirm (yes/no) prompt. Can be used standalone or with a prompt system like [Enquirer].

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
34K
decreased by-3.18%
Maintainers
2
Weekly downloads
 
Created
Source

prompt-confirm NPM version NPM downloads

Confirm (yes/no) prompt. Can be used standalone or with a prompt system like Enquirer.

prompt-confirm example

Install

Install with npm:

$ npm install --save prompt-confirm

Usage

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

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

Example

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

Single question

Ask one question using the .prompt method:

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

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

enquirer.question('chocolate', 'Like chocolate?', {type: 'confirm'});
enquirer.question('vanilla', 'Like vanilla?', {type: 'confirm'});

enquirer.prompt('vanilla')
  .then(function(answers) {
    console.log(answers)
  });

Functional

Functional style questions.

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

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

enquirer.question('chocolate', 'Like chocolate?', {type: 'confirm'});
enquirer.question('vanilla', 'Like vanilla?', {type: 'confirm'});

enquirer.ask(['chocolate', 'vanilla'])
  .then(function(answers) {
    console.log(answers)
  });

Declarative

Inquirer-style questions format.

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

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

var questions = [
  {type: 'confirm', name: 'chocolate', message: 'Like chocolate?'},
  {type: 'confirm', name: 'vanilla', message: 'Like vanilla?'}
];

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

Attribution

Based on the confirm prompt in inquirer.

About

  • enquirer-prompt: Base prompt module used for creating custom prompt types for Enquirer. | homepage
  • enquirer: Intuitive, plugin-based prompt system for node.js. Much faster and lighter alternative to Inquirer, with all… more | homepage
  • prompt-checkbox: Multiple-choice/checkbox prompt. Can be used standalone or with a prompt system like Enquirer. | homepage
  • prompt-radio: Radio prompt. This prompt behaves like other radio-button interfaces, where only one choice is enabled… more | homepage

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.2.0, on October 20, 2016.

Keywords

FAQs

Package last updated on 20 Oct 2016

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