2.0.0 • Published 3 months ago

@putout/cli-choose v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@putout/cli-choose NPM version

Show ui to choose one item from list.

Install

npm i @putout/cli-choose

Examples

import {choose} from '@putout/cli-choose';

choose('hello?', [
    'one',
    'two',
    'three',
    'four',
]);

// returns
'one';

When you need to set focus use autofocus:

import {choose} from './lib/choose.js';

const choices = [
    'one',
    'two',
    'three',
    'four',
];

choose('hello?', items, {
    autofocus: 3,
});

// show ui with focus on item 'three'.

License

MIT