Nice! I find making Node CLIs to be a good way of keeping things cross-platform friendly while still providing the flexibility of the command line.
For more complex projects, I use Commander.js which does a lot of the boilerplate stuff (like parsing arguments and flags) for you.
It allows you to write quite neat code like:
program .version('0.0.1') .option('-C, --chdir <path>', 'change the working directory') .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf') .option('-T, --no-tests', 'ignore test hook') program .command('setup') .description('run remote setup commands') .action(function() { console.log('setup'); }); program .command('exec <cmd>') .description('run the given remote command') .action(function(cmd) { console.log('exec "%s"', cmd); });
Thanks for sharing really appreciate it
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice! I find making Node CLIs to be a good way of keeping things cross-platform friendly while still providing the flexibility of the command line.
For more complex projects, I use Commander.js which does a lot of the boilerplate stuff (like parsing arguments and flags) for you.
It allows you to write quite neat code like:
Thanks for sharing really appreciate it