@putout/cli-choose
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