create nodejs cli select/options menu
Asked Answered
W

2

26

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?

Wolbrom answered 8/4, 2018 at 12:33 Comment(0)
C
27

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.

Copartner answered 8/4, 2018 at 17:37 Comment(1)
Inquirer nailed it. Thanks!Wolbrom
S
4

looks like 'inquirer' (npm i inquirer)

also for progress bars and such you should look at clui (npm i clui)

for parsing commands most use commander (npm commander) or the open cli framework (npm i oclif) - you can also look at yargs (very similar to commander, npm i yargs)

inquirer and clui work very well with both command parsers.

Have fun.

Super answered 30/8, 2018 at 9:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.