Socket
Book a DemoInstallSign in
Socket

chosen

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chosen

Easy and beautiful CLI multiple-choice selection

latest
npmnpm
Version
0.0.2
Version published
Weekly downloads
494
-0.6%
Maintainers
1
Weekly downloads
 
Created
Source

chosen

chosen is a node module to make multiple-choice questions easy on CLIs.

Install

npm install chosen

Use


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: <function>, chosen: <function>}, where the functions return a formatted version of their inputs

Interaction

chosen interaction was—ahem—chosen to be intuitive:

  • <enter> and <space> select the current choice
  • <esc> 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")

Keywords

CLI

FAQs

Package last updated on 08 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts