This package has been deprecated

Author message:

Use the autocomplete prompt from the enquirer package.

cli-autocomplete

0.4.3 • Public • Published

cli-autocomplete

Deprecated. Use the autocomplete prompt from enquirer.


A command line prompt with autocompletion. It provides just the ui, you are responsible for relevant completions.

asciicast

npm version build status dependency status dev dependency status ISC-licensed chat on gitter

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

Installing

npm install cli-autocomplete

Usage

const autocompletePrompt = require('cli-autocomplete')
 
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'}
]
const suggestColors = (input) => Promise.resolve(colors
    .filter((color) => color.title.slice(0, input.length) === input))
 
autocompletePrompt('What is your favorite color?', suggestColors)
.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.

Package Sidebar

Install

npm i cli-autocomplete

Weekly Downloads

21

Version

0.4.3

License

ISC

Unpacked Size

7.64 kB

Total Files

4

Last publish

Collaborators

  • derhuerst