1.0.2 • Published 9 years ago
yargs-default-command v1.0.2
yargs-default-command
A plugin for yargs which allows adding a default command that will match if called without a command or no other command matches.
Install
npm install --save yargs-default-command
Example
index.js:
#!/usr/bin/env node
var yargs = require('yargs');
var args = require('yargs-default-command')(yargs);
args
.command('*', 'default command', function(yargs) {
console.log('DEFAULT');
})
.command('build', 'build command', function(yargs) {
console.log('BUILD');
})
.args;
Output:
$ ./index.js build
BUILD
$ ./index.js foo
DEFAULT
$ ./index.js
DEFAULT