Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cli-autocomplete

derhuerst63ISCdeprecated0.4.3

Use the autocomplete prompt from the enquirer package.

A command line prompt with autocompletion.

command, line, cli, prompt, autocomplete, completion, prompt

readme

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))

Contributing

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