0.3.2 • Published 5 years ago

select-prompt v0.3.2

Weekly downloads
202
License
ISC
Repository
github
Last release
5 years ago

select-prompt

Deprecated. Use the select prompt from enquirer.


A prompt to an item from a list.

asciicast

npm version dependency status ISC-licensed chat on gitter

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

Installing

npm install select-prompt

Usage

const prompt = require('select-prompt')

const colors = [
	{title: 'red',    value: '#f00'},
	{title: 'yellow', value: '#ff0'},
	{title: 'green',  value: '#0f0'},
	{title: 'blue',   value: '#00f'},
	{title: 'black',  value: '#000'},
	{title: 'white',  value: '#fff'}
]

prompt('What is your favorite color?', colors, {cursor: 3})
.on('data', (e) => console.log('Interim value', e.value))
.on('abort', (v) => console.log('Aborted with', v))
.on('submit', (v) => console.log('Submitted 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.