Approach to create CLI application

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.

  1. Parse arguments – yargs https://www.npmjs.com/package/yargs
  2. Create commands – commanderhttps://www.npmjs.com/package/commander
  3. Show spinner – ora https://www.npmjs.com/package/ora
  4. Show prompts and parse the input answer – inquirerhttps://www.npmjs.com/package/inquirer
  5. Add colors to output – chalk, colors https://www.npmjs.com/package/chalk, https://www.npmjs.com/package/colors
  6. Store key pair data – configstore https://www.npmjs.com/package/configstore
  7. Show beautiful ascii art – figlet https://www.npmjs.com/package/figlet
  8. Issue operating system commands – shelljs https://www.npmjs.com/package/shelljs
  9. Make API calls – node-fetchhttps://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.

Published by Shailendra Ahir

Programmer, Author

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: