CLI is part of everyday life for a developer. You almost always find yourself using some sort of Command line. Let us discuss How you can create one CLI app for easing your workflow.
We will discuss the high level approach and some tools that are useful.
- Parse arguments – yargs – https://www.npmjs.com/package/yargs
- Create commands – commander – https://www.npmjs.com/package/commander
- Show spinner – ora – https://www.npmjs.com/package/ora
- Show prompts and parse the input answer – inquirer– https://www.npmjs.com/package/inquirer
- Add colors to output – chalk, colors – https://www.npmjs.com/package/chalk, https://www.npmjs.com/package/colors
- Store key pair data – configstore – https://www.npmjs.com/package/configstore
- Show beautiful ascii art – figlet – https://www.npmjs.com/package/figlet
- Issue operating system commands – shelljs – https://www.npmjs.com/package/shelljs
- Make API calls – node-fetch – https://www.npmjs.com/package/node-fetch
These tools are more than sufficient in building a professional CLI, experiment and read the documentation of these libraries to get the maximum output.