tty-select
v0.9.2
Published
Console/terminal async selector
Downloads
1
Readme
tty-select
Creates async an in-line selector from a simple string on the terminal.
Install
npm install tty-select
Use
import { select } from 'tty-select';
select('Need you to say {*^yes} or {^no}').then((choice) => console.log('You said:', choice.text))
Renders on console as: "Need you to say yes or no" (with "yes" highlighted)
Symbols
{
and}
mark the boundaries of a selectable text- Within the selectable text: a starting
*
marks the pre-selected option - Within the selectable text:
^
marks the following character as shortcut (case-insensitive) All these symbols can be escaped by prefixing them with abackslash
.
Selection
right
ortab
: moves selection to the rightend
: moves selection to the last selectable itemleft
orshift
+tab
: moves selection to the lefthome
: moves selection to the first selectable itementer
: returns highlighted selection- any shortcut: selects item, and returns it