node.jscommand-line-interfacenode-commandervorpal.js

create nodejs cli select/options menu


How do you create an arrow-key menu list?

I'm looking for something like after entering in eslint init or create-react-app <project>? (see images below)

ESlint

eslint CLI menu

yeoman

create-react-app cli menu

Searching around to find ways to create a CLI, I found NodeJS to be an option followed by a few tools: Commander.js, Vorpal, and/or create-new-cli.

If I am on the right track, how can I create a CLI arrow-key select menu?


Solution

  • I believe yeoman is using inquirer. Source: yo's dependencies.

    I've also seen prompts which has a similar arrow selection feature and other cli ui/ux features. See the demos about halfway down the page.

    Note: I've never actually used either, I'm just in the same research phase.