https://github.com/axtgr/yargs-default-command
DEPRECATED
https://github.com/axtgr/yargs-default-command
Last synced: 7 days ago
JSON representation
DEPRECATED
- Host: GitHub
- URL: https://github.com/axtgr/yargs-default-command
- Owner: axtgr
- Created: 2015-11-07T21:51:13.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-19T03:38:01.000Z (about 9 years ago)
- Last Synced: 2025-02-19T13:40:02.244Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## DEPRECATED
Since v7.0.0, yargs supports default commands natively.
----------
# yargs-default-command
A plugin for [yargs](https://github.com/bcoe/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:
```javascript
#!/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
```