Skip to content

Instantly share code, notes, and snippets.

@jameswomack
Created March 17, 2014 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameswomack/9595987 to your computer and use it in GitHub Desktop.
Save jameswomack/9595987 to your computer and use it in GitHub Desktop.
var commander = require('commander');
commander.version('0.0.1').command('new');
commander.parse(process.argv);
console.log(commander.commands);
var matches = commander.commands.filter(function(c){
return c._name == commander.args[0];
});
if (!matches.length
&& commander.args.length <= 1
&& typeof commander.args[0] === 'string') {
console.error('Argument ' + commander.args[0] + ' not recognized.');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment