yargs 3.7.1 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +23 -7
- package/index.js +461 -456
- package/lib/completion.js +29 -29
- package/lib/parser.js +349 -354
- package/lib/usage.js +289 -381
- package/lib/validation.js +186 -187
- package/package.json +19 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
## Change Log
|
|
2
2
|
|
|
3
|
+
### v3.9.1 (2015/05/20 05:14 +00:00)
|
|
4
|
+
- [b6662b6](https://github.com/bcoe/yargs/commit/b6662b6774cfeab4876f41ec5e2f67b7698f4e2f) clarify .config() docs (@linclark)
|
|
5
|
+
- [0291360](https://github.com/bcoe/yargs/commit/02913606285ce31ce81d7f12c48d8a3029776ec7) fixed tests, switched to nyc for coverage, fixed security issue, added Lin as collaborator (@bcoe)
|
|
6
|
+
|
|
7
|
+
### v3.9.0 (2015/05/10 18:32 +00:00)
|
|
8
|
+
- [#157](https://github.com/bcoe/yargs/pull/157) Merge pull request #157 from bcoe/command-yargs. allows handling of command specific arguments. Thanks for the suggestion @ohjames (@bcoe)
|
|
9
|
+
- [#158](https://github.com/bcoe/yargs/pull/158) Merge pull request #158 from kemitchell/spdx-license. Update license format (@kemitchell)
|
|
10
|
+
|
|
11
|
+
### v3.8.0 (2015/04/24 23:10 +00:00)
|
|
12
|
+
- [#154](https://github.com/bcoe/yargs/pull/154) showHelp's method signature was misleading fixes #153 (@bcoe)
|
|
13
|
+
- [#151](https://github.com/bcoe/yargs/pull/151) refactor yargs' table layout logic to use new helper library (@bcoe)
|
|
14
|
+
- [#150](https://github.com/bcoe/yargs/pull/150) Fix README example in argument requirements (@annonymouse)
|
|
15
|
+
|
|
16
|
+
### v3.7.2 (2015/04/13 11:52 -07:00)
|
|
17
|
+
|
|
18
|
+
* [679fbbf](https://github.com/bcoe/yargs/commit/679fbbf55904030ccee8a2635e8e5f46551ab2f0) updated yargs to use the [standard](https://github.com/feross/standard) style guide (agokjr)
|
|
19
|
+
* [22382ee](https://github.com/bcoe/yargs/commit/22382ee9f5b495bc2586c1758cd1091cec3647f9 various bug fixes for $0 (@nylen)
|
|
20
|
+
|
|
3
21
|
### v3.7.1 (2015/04/10 11:06 -07:00)
|
|
4
22
|
|
|
5
23
|
* [89e1992](https://github.com/bcoe/yargs/commit/89e1992a004ba73609b5f9ee6890c4060857aba4) detect iojs bin along with node bin. (@bcoe)
|
package/README.md
CHANGED
|
@@ -167,7 +167,7 @@ console.log("The area is:", argv.w * argv.h);
|
|
|
167
167
|
|
|
168
168
|
***
|
|
169
169
|
|
|
170
|
-
$ ./area.js -w 55 -
|
|
170
|
+
$ ./area.js -w 55 -h 11
|
|
171
171
|
605
|
|
172
172
|
|
|
173
173
|
$ node ./area.js -w 4.91 -w 2.51
|
|
@@ -501,18 +501,33 @@ present script similar to how `$0` works in bash or perl.
|
|
|
501
501
|
|
|
502
502
|
`opts` is optional and acts like calling `.options(opts)`.
|
|
503
503
|
|
|
504
|
-
.command(cmd, desc)
|
|
504
|
+
.command(cmd, desc, [fn])
|
|
505
505
|
-------------------
|
|
506
506
|
|
|
507
|
-
Document the commands exposed by your application
|
|
507
|
+
Document the commands exposed by your application.
|
|
508
508
|
|
|
509
|
-
|
|
509
|
+
use `desc` to provide a description for each command your application accepts (the
|
|
510
|
+
values stored in `argv._`).
|
|
511
|
+
|
|
512
|
+
Optionally, you can provide a handler `fn` which will be executed when
|
|
513
|
+
a given command is provided. The handler will be executed with an instance
|
|
514
|
+
of `yargs`, which can be used to compose nested commands.
|
|
515
|
+
|
|
516
|
+
Here's an example of top-level and nested commands in action:
|
|
510
517
|
|
|
511
518
|
```js
|
|
512
519
|
var argv = require('yargs')
|
|
513
520
|
.usage('npm <command>')
|
|
514
521
|
.command('install', 'tis a mighty fine package to install')
|
|
515
|
-
.command('publish', 'shiver me timbers, should you be sharing all that')
|
|
522
|
+
.command('publish', 'shiver me timbers, should you be sharing all that', function (yargs) {
|
|
523
|
+
argv = yargs.option('f', {
|
|
524
|
+
alias: 'force',
|
|
525
|
+
description: 'yar, it usually be a bad idea'
|
|
526
|
+
})
|
|
527
|
+
.help('help')
|
|
528
|
+
.argv
|
|
529
|
+
})
|
|
530
|
+
.help('help')
|
|
516
531
|
.argv;
|
|
517
532
|
```
|
|
518
533
|
|
|
@@ -603,8 +618,9 @@ Optionally `.nargs()` can take an object of `key`/`narg` pairs.
|
|
|
603
618
|
.config(key)
|
|
604
619
|
------------
|
|
605
620
|
|
|
606
|
-
Tells the parser
|
|
607
|
-
|
|
621
|
+
Tells the parser that if the option specified by `key` is passed in, it
|
|
622
|
+
should be interpreted as a path to a JSON config file. The file is loaded
|
|
623
|
+
and parsed, and its properties are set as arguments.
|
|
608
624
|
|
|
609
625
|
.wrap(columns)
|
|
610
626
|
--------------
|