bare-select-prompts
v0.0.3
Published
Single and multiple select prompts for interactive CLIs
Downloads
1
Readme
bare-select-prompts
Single and multiple select prompts for interactive CLIs.
npm i bare-select-prompts
Usage
const selection = require("bare-select-prompts");
process.stdin.setRawMode(true);
const sl = selection.createInterface({
input: process.stdin,
output: process.stdout,
options: ["foo", "bar", "baz"],
});
sl.on("selection", (selection) => {
console.log("The user selected: " + (selection ? selection : "nothing"));
process.exit();
});
sl.on("close", () => {
console.log("Exiting...");
process.exit();
});
Output
[ ] foo
[*] bar
[ ] baz
Selected option: bar
The user selected: bar
License
Apache-2.0