https://github.com/kach/chosen
Easy and beautiful CLI multiple-choice selection
https://github.com/kach/chosen
Last synced: about 1 month ago
JSON representation
Easy and beautiful CLI multiple-choice selection
- Host: GitHub
- URL: https://github.com/kach/chosen
- Owner: kach
- Created: 2014-08-08T01:58:13.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-08-08T02:53:30.000Z (almost 12 years ago)
- Last Synced: 2025-03-23T14:37:03.714Z (about 1 year ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
chosen
======
chosen is a node module to make multiple-choice questions easy on CLIs.
Install
-------
`npm install chosen`
Use
---
```js
var choose = require("chosen").choose;
console.log("What is your favorite language?");
choose(
["English", "Klingon", "Malbolge"],
function(answer, index) {
console.log("I like " + answer + ", too!");
},
{} // options
);
```
Styles
------
You can feed any of the following options:
* **style**: one of `[">", "gray", "indent"]`, or an object `{normal: , chosen: }`, where the functions return a formatted version of their inputs
Interaction
-----------
chosen interaction was—ahem—*chosen* to be intuitive:
* `` and `` select the current choice
* `` and `<^C>` to escape (sends `null`)
* `(up arrow, down arrow)`, `(k,j)` (vim!),`(q, a)`, and `(p, l)` for scrolling up/down (any other key defaults to "down")