0.9.2 • Published 2 years ago

tty-select v0.9.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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 a backslash.

Selection

  • right or tab: moves selection to the right
  • end: moves selection to the last selectable item
  • left or shift+tab: moves selection to the left
  • home: moves selection to the first selectable item
  • enter: returns highlighted selection
  • any shortcut: selects item, and returns it
0.9.2

2 years ago

0.9.1

2 years ago

0.9.0

2 years ago