select-shell
Item selection for commandline nodejs apps.
- Easy to use.
- Single / multiple item-select.
- Optional cancel message.
- Color/styling/spacing options.
- Only depends on 'colors'!
Installation
npm install select-shell
Usage
Simply navigate + make selection with the arrow keys...
Up and Down - Navigates on the options
Right - Check the option
Left - Uncheck the option
Enter/Return - confirms the options selected
Esc - Cancel/Exit
Code
'use strict'; var list = /* possible configs */ pointer: ' ▸ ' pointerColor: 'yellow' checked: ' ◉ ' unchecked:' ◎ ' checkedColor: 'blue' msgCancel: 'No selected options!' msgCancelColor: 'orange' multiSelect: true inverse: true prepend: true disableInput: true ; var stream = processstdin; list ; list; list;
Optional configs
var select = /* These are the default values */ pointer: '> ' pointerColor: 'white' checked: ' ✓' unchecked: '' checkedColor: 'green' msgCancel: 'No selected options!' msgCancelColor: 'red' multiSelect: true inverse: false prepend: false disableInput: true ;
sample.coffee
.
And for coffee drinkers, please see list = require'.' pointer : ' ► ' checked : ' ◉ ' unchecked : ' ◎ ' prepend : true
colors.
The scheme of color is equal to the modulestyle | color | theme |
---|---|---|
bold | yellow | rainbow |
italic | cyan | random |
underline | white | zebra |
inverse | magenta | |
green | ||
red | ||
grey | ||
blue |