0.9.2 • Published 3 years ago
tty-select v0.9.2
tty-select
Creates async an in-line selector from a simple string on the terminal.
Install
npm install tty-selectUse
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
rightortab: moves selection to the rightend: moves selection to the last selectable itemleftorshift+tab: moves selection to the lefthome: moves selection to the first selectable itementer: returns highlighted selection- any shortcut: selects item, and returns it