https://www.npmjs.com/package/yargs
yargs is an easy way to write a command line parser
Example:
yargs(hideBin(process.argv))
.command('serve [port]', 'start the server', (yargs) => {
return yargs
.positional('port', {
describe: 'port to bind on',
default: 5000
})
}, (argv) => {
if (argv.verbose) console.info(`start server on :${argv.port}`)
serve(argv.port)
})
.option('verbose', {
alias: 'v',
type: 'boolean',
description: 'Run with verbose logging'
})
.parse()
Schedule a meeting with me to agree on some consistency for arg parsing
AC:
yargs instead of (pass-by-env + handwritten enforcement)