yargs 7.0.0 → 7.1.0
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 +37 -0
- package/README.md +5 -5
- package/lib/validation.js +1 -1
- package/package.json +1 -1
- package/yargs.js +23 -19
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
<a name="7.1.0"></a>
|
|
6
|
+
# [7.1.0](https://github.com/yargs/yargs/compare/v7.0.2...v7.1.0) (2017-04-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix demandOption no longer treats 'false' as truthy ([#829](https://github.com/yargs/yargs/issues/829)) ([c748dd2](https://github.com/yargs/yargs/commit/c748dd2))
|
|
12
|
+
* get terminalWidth in non interactive mode no longer causes a validation exception ([#837](https://github.com/yargs/yargs/issues/837)) ([360e301](https://github.com/yargs/yargs/commit/360e301))
|
|
13
|
+
* we shouldn't output help if we've printed a prior help-like message ([#847](https://github.com/yargs/yargs/issues/847)) ([17e89bd](https://github.com/yargs/yargs/commit/17e89bd))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* add support for numeric commands ([#825](https://github.com/yargs/yargs/issues/825)) ([fde0564](https://github.com/yargs/yargs/commit/fde0564))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<a name="7.0.2"></a>
|
|
23
|
+
## [7.0.2](https://github.com/yargs/yargs/compare/v7.0.1...v7.0.2) (2017-03-10)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* populating placeholder arguments broke validation ([b3eb2fe](https://github.com/yargs/yargs/commit/b3eb2fe))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<a name="7.0.1"></a>
|
|
33
|
+
## [7.0.1](https://github.com/yargs/yargs/compare/v7.0.0...v7.0.1) (2017-03-03)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* --help with default command should print top-level help ([#810](https://github.com/yargs/yargs/issues/810)) ([9c03fa4](https://github.com/yargs/yargs/commit/9c03fa4))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
5
42
|
<a name="7.0.0"></a>
|
|
6
43
|
# [7.0.0](https://github.com/yargs/yargs/compare/v6.6.0...v7.0.0) (2017-02-26)
|
|
7
44
|
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ With yargs, ye be havin' a map that leads straight to yer treasure! Treasure of
|
|
|
10
10
|
[![NPM version][npm-image]][npm-url]
|
|
11
11
|
[![Windows Tests][windows-image]][windows-url]
|
|
12
12
|
[![js-standard-style][standard-image]][standard-url]
|
|
13
|
-
[![
|
|
13
|
+
[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
|
|
14
14
|
[![Gitter][gitter-image]][gitter-url]
|
|
15
15
|
|
|
16
16
|
> Yargs is the official successor to optimist. Please feel free to submit issues and pull requests. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/yargs/yargs/issues) :)
|
|
@@ -1203,8 +1203,8 @@ then all env vars will be applied to argv.
|
|
|
1203
1203
|
Program arguments are defined in this order of precedence:
|
|
1204
1204
|
|
|
1205
1205
|
1. Command line args
|
|
1206
|
-
2.
|
|
1207
|
-
3.
|
|
1206
|
+
2. Env vars
|
|
1207
|
+
3. Config file/objects
|
|
1208
1208
|
4. Configured defaults
|
|
1209
1209
|
|
|
1210
1210
|
```js
|
|
@@ -2011,7 +2011,7 @@ This module is loosely inspired by Perl's
|
|
|
2011
2011
|
[windows-image]: https://img.shields.io/appveyor/ci/bcoe/yargs-ljwvf/master.svg?label=Windows%20Tests
|
|
2012
2012
|
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
|
|
2013
2013
|
[standard-url]: http://standardjs.com/
|
|
2014
|
-
[
|
|
2015
|
-
[
|
|
2014
|
+
[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
|
|
2015
|
+
[conventional-commits-url]: https://conventionalcommits.org/
|
|
2016
2016
|
[gitter-image]: https://img.shields.io/gitter/room/nwjs/nw.js.svg?maxAge=2592000
|
|
2017
2017
|
[gitter-url]: https://gitter.im/yargs/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link
|
package/lib/validation.js
CHANGED
|
@@ -89,7 +89,7 @@ module.exports = function (yargs, usage, y18n) {
|
|
|
89
89
|
var missing = null
|
|
90
90
|
|
|
91
91
|
Object.keys(demandedOptions).forEach(function (key) {
|
|
92
|
-
if (!argv.hasOwnProperty(key)) {
|
|
92
|
+
if (!argv.hasOwnProperty(key) || typeof argv[key] === 'undefined') {
|
|
93
93
|
missing = missing || {}
|
|
94
94
|
missing[key] = demandedOptions[key]
|
|
95
95
|
}
|
package/package.json
CHANGED
package/yargs.js
CHANGED
|
@@ -567,7 +567,7 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
567
567
|
self.demand(key, demand)
|
|
568
568
|
}
|
|
569
569
|
|
|
570
|
-
if (
|
|
570
|
+
if (opt.demandOption) {
|
|
571
571
|
self.demandOption(key, typeof opt.demandOption === 'string' ? opt.demandOption : undefined)
|
|
572
572
|
}
|
|
573
573
|
|
|
@@ -922,7 +922,7 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
922
922
|
|
|
923
923
|
self.terminalWidth = function () {
|
|
924
924
|
argsert([], 0)
|
|
925
|
-
return process.stdout.columns
|
|
925
|
+
return typeof process.stdout.columns !== 'undefined' ? process.stdout.columns : null
|
|
926
926
|
}
|
|
927
927
|
|
|
928
928
|
Object.defineProperty(self, 'argv', {
|
|
@@ -983,7 +983,8 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
983
983
|
var handlerKeys = command.getCommands()
|
|
984
984
|
if (handlerKeys.length) {
|
|
985
985
|
var firstUnknownCommand
|
|
986
|
-
for (var i = 0, cmd;
|
|
986
|
+
for (var i = 0, cmd; argv._[i] !== undefined; i++) {
|
|
987
|
+
cmd = String(argv._[i])
|
|
987
988
|
if (~handlerKeys.indexOf(cmd) && cmd !== completionCommand) {
|
|
988
989
|
setPlaceholderKeys(argv)
|
|
989
990
|
return command.runCommand(cmd, self, parsed)
|
|
@@ -1011,7 +1012,7 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
1011
1012
|
self.showCompletionScript()
|
|
1012
1013
|
self.exit(0)
|
|
1013
1014
|
}
|
|
1014
|
-
} else if (command.hasDefaultCommand()) {
|
|
1015
|
+
} else if (command.hasDefaultCommand() && !argv[helpOpt]) {
|
|
1015
1016
|
setPlaceholderKeys(argv)
|
|
1016
1017
|
return command.runCommand(null, self, parsed)
|
|
1017
1018
|
}
|
|
@@ -1035,21 +1036,24 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
1035
1036
|
}
|
|
1036
1037
|
|
|
1037
1038
|
// Handle 'help' and 'version' options
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1039
|
+
// if we haven't already output help!
|
|
1040
|
+
if (!hasOutput) {
|
|
1041
|
+
Object.keys(argv).forEach(function (key) {
|
|
1042
|
+
if (key === helpOpt && argv[key]) {
|
|
1043
|
+
if (exitProcess) setBlocking(true)
|
|
1044
|
+
|
|
1045
|
+
skipValidation = true
|
|
1046
|
+
self.showHelp('log')
|
|
1047
|
+
self.exit(0)
|
|
1048
|
+
} else if (key === versionOpt && argv[key]) {
|
|
1049
|
+
if (exitProcess) setBlocking(true)
|
|
1050
|
+
|
|
1051
|
+
skipValidation = true
|
|
1052
|
+
usage.showVersion()
|
|
1053
|
+
self.exit(0)
|
|
1054
|
+
}
|
|
1055
|
+
})
|
|
1056
|
+
}
|
|
1053
1057
|
|
|
1054
1058
|
// Check if any of the options to skip validation were provided
|
|
1055
1059
|
if (!skipValidation && options.skipValidation.length > 0) {
|