Learning yargs
Just one of the things I'm learning. https://github.com/hchiam/learning
https://yargs.js.org (and I might also like to use https://www.npmjs.com/package/glob)
You can even run yargs in the browser: https://github.com/yargs/yargs/blob/75f98fbd7997c6cfbf04998844ebea0a8e09c2fc/docs/browser.md (Live demo: https://codepen.io/hchiam/pen/BazLBax)
Using yarn:
yarn add yargsOr with npm:
npm install yargsAnd then create my-cli.js and run any of these commands in CLI:
node my-cli.js
node my-cli # you don't need the .js!
node my-cli --help # --help doc comes for free!
node my-cli --version # --version comes for free!
node my-cli hello --name Howard # hello command with name argument
node my-cli hello # will use fallback/default value
node my-cli hello Howard # positional argument
node my-cli bye Howard # another command
node my-cli --help bye # info on specific command (args, etc.)Using yarn: (triple-click to select all)
git clone https://github.com/hchiam/learning-yargs.git; cd learning-yargs; yarn;Or with npm: (triple-click to select all)
git clone https://github.com/hchiam/learning-yargs.git; cd learning-yargs; npm install;And then run any of the node my-cli.js commands above.