Miss any of our Open RFC calls?Watch the recordings here! »

This package has been deprecated

Author message:

Use the confirm or select prompt from the enquirer package.

switch-prompt

0.1.0 • Public • Published

switch-prompt

A CLI prompt with an iOS-style on/off switch.

asciicast

npm version dependency status ISC-licensed

switch-prompt uses cli-styles and prompt-skeleton to have a look & feel consistent with other prompts.

Installing

npm install switch-prompt

Usage

switchPrompt(question, [activeText], [inactiveText], [defaultValue])
const switchPrompt = require('switch-prompt')
switchPrompt('Send anonymous usage data?', 'yes', 'no', true)
.on('data', (e) => console.log('Interim value', e.value))
.on('submit', (v) => console.log('Submitted with', v))
.on('abort', (v) => console.log('Aborted with', v))

Related

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.

Install

npm i switch-prompt

DownloadsWeekly Downloads

2

Version

0.1.0

License

ISC

Last publish

Collaborators

  • avatar