1.0.2 • Published 9 years ago

yargs-default-command v1.0.2

Weekly downloads
7
License
MIT
Repository
github
Last release
9 years ago

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
1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago