yargs 11.1.0 → 11.1.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 +5 -2
- package/README.md +11 -23
- package/lib/apply-extends.js +1 -1
- package/lib/usage.js +10 -17
- package/package.json +2 -2
- package/yargs.js +3 -27
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
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="11.1.1"></a>
|
|
6
|
+
# [11.1.1](https://github.com/yargs/yargs/compare/v11.1.0...v11.1.1) (2019-10-06)
|
|
7
|
+
|
|
8
|
+
* backport security fix for os-locale.
|
|
9
|
+
|
|
5
10
|
<a name="11.1.0"></a>
|
|
6
11
|
# [11.1.0](https://github.com/yargs/yargs/compare/v11.0.0...v11.1.0) (2018-03-04)
|
|
7
12
|
|
|
@@ -16,8 +21,6 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
16
21
|
* allow hidden options to be displayed with --show-hidden ([#1061](https://github.com/yargs/yargs/issues/1061)) ([ea862ae](https://github.com/yargs/yargs/commit/ea862ae))
|
|
17
22
|
* extend *.rc files in addition to json ([#1080](https://github.com/yargs/yargs/issues/1080)) ([11691a6](https://github.com/yargs/yargs/commit/11691a6))
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
24
|
<a name="11.0.0"></a>
|
|
22
25
|
# [11.0.0](https://github.com/yargs/yargs/compare/v10.1.2...v11.0.0) (2018-01-22)
|
|
23
26
|
|
package/README.md
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
<img width="250" src="/yargs-logo.png">
|
|
3
|
-
</p>
|
|
4
|
-
<h1 align="center"> Yargs </h1>
|
|
5
|
-
<p align="center">
|
|
6
|
-
<b >Yargs be a node.js library fer hearties tryin' ter parse optstrings</b>
|
|
7
|
-
</p>
|
|
8
|
-
<br>
|
|
1
|
+
# Yargs
|
|
9
2
|
|
|
10
3
|
[![Build Status][travis-image]][travis-url]
|
|
11
4
|
[![Coverage Status][coveralls-image]][coveralls-url]
|
|
@@ -15,10 +8,13 @@
|
|
|
15
8
|
[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
|
|
16
9
|
[![Slack][slack-image]][slack-url]
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
|
|
11
|
+
_Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com)_.
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
> Yargs be a node.js library fer hearties tryin' ter parse optstrings.
|
|
14
|
+
|
|
15
|
+
<img width="250" src="/yargs-logo.png">
|
|
16
|
+
|
|
17
|
+
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. It gives you:
|
|
22
18
|
|
|
23
19
|
* commands and (grouped) options (`my-program.js serve --port=5000`).
|
|
24
20
|
* a dynamically generated help menu based on your arguments.
|
|
@@ -34,9 +30,7 @@ It gives you:
|
|
|
34
30
|
npm i yargs --save
|
|
35
31
|
```
|
|
36
32
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
### Simple Example
|
|
33
|
+
## Simple Example
|
|
40
34
|
|
|
41
35
|
````javascript
|
|
42
36
|
#!/usr/bin/env node
|
|
@@ -57,9 +51,9 @@ $ ./plunder.js --ships 12 --distance 98.7
|
|
|
57
51
|
Retreat from the xupptumblers!
|
|
58
52
|
```
|
|
59
53
|
|
|
60
|
-
|
|
54
|
+
## Complex Example
|
|
61
55
|
|
|
62
|
-
```
|
|
56
|
+
```js
|
|
63
57
|
#!/usr/bin/env node
|
|
64
58
|
require('yargs') // eslint-disable-line
|
|
65
59
|
.command('serve [port]', 'start the server', (yargs) => {
|
|
@@ -81,13 +75,7 @@ require('yargs') // eslint-disable-line
|
|
|
81
75
|
|
|
82
76
|
Run the example above with `--help` to see the help for the application.
|
|
83
77
|
|
|
84
|
-
##
|
|
85
|
-
|
|
86
|
-
Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
|
|
87
|
-
|
|
88
|
-
## Documentation :
|
|
89
|
-
|
|
90
|
-
### Table of Contents
|
|
78
|
+
## Table of Contents
|
|
91
79
|
|
|
92
80
|
* [Yargs' API](/docs/api.md)
|
|
93
81
|
* [Examples](/docs/examples.md)
|
package/lib/apply-extends.js
CHANGED
|
@@ -21,7 +21,7 @@ function applyExtends (config, cwd) {
|
|
|
21
21
|
|
|
22
22
|
if (config.hasOwnProperty('extends')) {
|
|
23
23
|
if (typeof config.extends !== 'string') return defaultConfig
|
|
24
|
-
const isPath = /\.json
|
|
24
|
+
const isPath = /\.json$/.test(config.extends)
|
|
25
25
|
let pathToDefault = null
|
|
26
26
|
if (!isPath) {
|
|
27
27
|
try {
|
package/lib/usage.js
CHANGED
|
@@ -152,23 +152,16 @@ module.exports = function usage (yargs, y18n) {
|
|
|
152
152
|
const demandedCommands = yargs.getDemandedCommands()
|
|
153
153
|
const groups = yargs.getGroups()
|
|
154
154
|
const options = yargs.getOptions()
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return true
|
|
166
|
-
}
|
|
167
|
-
})
|
|
168
|
-
keys = Object.keys(keys.reduce((acc, key) => {
|
|
169
|
-
if (key !== '_') acc[key] = true
|
|
170
|
-
return acc
|
|
171
|
-
}, {}))
|
|
155
|
+
let keys = Object.keys(
|
|
156
|
+
Object.keys(descriptions)
|
|
157
|
+
.concat(Object.keys(demandedOptions))
|
|
158
|
+
.concat(Object.keys(demandedCommands))
|
|
159
|
+
.concat(Object.keys(options.default))
|
|
160
|
+
.reduce((acc, key) => {
|
|
161
|
+
if (key !== '_') acc[key] = true
|
|
162
|
+
return acc
|
|
163
|
+
}, {})
|
|
164
|
+
)
|
|
172
165
|
|
|
173
166
|
const theWrap = getWrap()
|
|
174
167
|
const ui = require('cliui')({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yargs",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.1",
|
|
4
4
|
"description": "yargs the modern, pirate-themed, successor to optimist.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"files": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"decamelize": "^1.1.1",
|
|
17
17
|
"find-up": "^2.1.0",
|
|
18
18
|
"get-caller-file": "^1.0.1",
|
|
19
|
-
"os-locale": "^
|
|
19
|
+
"os-locale": "^3.1.0",
|
|
20
20
|
"require-directory": "^2.1.1",
|
|
21
21
|
"require-main-filename": "^1.0.1",
|
|
22
22
|
"set-blocking": "^2.0.0",
|
package/yargs.js
CHANGED
|
@@ -93,8 +93,7 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
93
93
|
|
|
94
94
|
const arrayOptions = [
|
|
95
95
|
'array', 'boolean', 'string', 'skipValidation',
|
|
96
|
-
'count', 'normalize', 'number'
|
|
97
|
-
'hiddenOptions'
|
|
96
|
+
'count', 'normalize', 'number'
|
|
98
97
|
]
|
|
99
98
|
|
|
100
99
|
const objectOptions = [
|
|
@@ -658,9 +657,8 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
658
657
|
}
|
|
659
658
|
|
|
660
659
|
const desc = opt.describe || opt.description || opt.desc
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
self.hide(key)
|
|
660
|
+
if (!opt.hidden) {
|
|
661
|
+
self.describe(key, desc)
|
|
664
662
|
}
|
|
665
663
|
|
|
666
664
|
if (opt.requiresArg) {
|
|
@@ -826,28 +824,6 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
826
824
|
return self
|
|
827
825
|
}
|
|
828
826
|
|
|
829
|
-
const defaultShowHiddenOpt = 'show-hidden'
|
|
830
|
-
options.showHiddenOpt = defaultShowHiddenOpt
|
|
831
|
-
self.addShowHiddenOpt = self.showHidden = function addShowHiddenOpt (opt, msg) {
|
|
832
|
-
argsert('[string|boolean] [string]', [opt, msg], arguments.length)
|
|
833
|
-
|
|
834
|
-
if (arguments.length === 1) {
|
|
835
|
-
if (opt === false) return self
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
const showHiddenOpt = typeof opt === 'string' ? opt : defaultShowHiddenOpt
|
|
839
|
-
self.boolean(showHiddenOpt)
|
|
840
|
-
self.describe(showHiddenOpt, msg || usage.deferY18nLookup('Show hidden options'))
|
|
841
|
-
options.showHiddenOpt = showHiddenOpt
|
|
842
|
-
return self
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
self.hide = function hide (key) {
|
|
846
|
-
argsert('<string|object>', [key], arguments.length)
|
|
847
|
-
options.hiddenOptions.push(key)
|
|
848
|
-
return self
|
|
849
|
-
}
|
|
850
|
-
|
|
851
827
|
self.showHelpOnFail = function showHelpOnFail (enabled, message) {
|
|
852
828
|
argsert('[boolean|string] [string]', [enabled, message], arguments.length)
|
|
853
829
|
usage.showHelpOnFail(enabled, message)
|