yargs 6.1.1 → 6.3.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 +32 -1
- package/README.md +5 -1
- package/lib/command.js +3 -0
- package/locales/it.json +3 -1
- package/locales/pt_BR.json +3 -1
- package/locales/th.json +39 -0
- package/package.json +2 -2
- package/yargs.js +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
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="6.3.0"></a>
|
|
6
|
+
# [6.3.0](https://github.com/yargs/yargs/compare/v6.2.0...v6.3.0) (2016-10-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **command:** subcommands via commandDir() now supported for parse(msg, cb) ([#678](https://github.com/yargs/yargs/issues/678)) ([6b85cc6](https://github.com/yargs/yargs/commit/6b85cc6))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **locales:** Add Thai locale file ([#679](https://github.com/yargs/yargs/issues/679)) ([c05e36b](https://github.com/yargs/yargs/commit/c05e36b))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
<a name="6.2.0"></a>
|
|
21
|
+
# [6.2.0](https://github.com/yargs/yargs/compare/v6.1.1...v6.2.0) (2016-10-16)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* stop applying parser to context object ([#675](https://github.com/yargs/yargs/issues/675)) ([3fe9b8f](https://github.com/yargs/yargs/commit/3fe9b8f))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* add new pt_BR translations ([#674](https://github.com/yargs/yargs/issues/674)) ([5615a82](https://github.com/yargs/yargs/commit/5615a82))
|
|
32
|
+
* Italian translations for 'did you mean' and 'aliases' ([#673](https://github.com/yargs/yargs/issues/673)) ([81984e6](https://github.com/yargs/yargs/commit/81984e6))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
5
36
|
<a name="6.1.1"></a>
|
|
6
37
|
## [6.1.1](https://github.com/yargs/yargs/compare/v6.1.0...v6.1.1) (2016-10-15)
|
|
7
38
|
|
|
@@ -86,7 +117,6 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
86
117
|
* adds recommendCommands() for command suggestions ([#580](https://github.com/yargs/yargs/issues/580)) ([59474dc](https://github.com/yargs/yargs/commit/59474dc))
|
|
87
118
|
* apply .env() globally ([#553](https://github.com/yargs/yargs/issues/553)) ([be65728](https://github.com/yargs/yargs/commit/be65728))
|
|
88
119
|
* apply default builder to command() and apply fail() handlers globally ([#583](https://github.com/yargs/yargs/issues/583)) ([0aaa68b](https://github.com/yargs/yargs/commit/0aaa68b))
|
|
89
|
-
* interpret demand() numbers as relative to executing command ([#582](https://github.com/yargs/yargs/issues/582)) ([927810c](https://github.com/yargs/yargs/commit/927810c))
|
|
90
120
|
* update yargs-parser to version 3.1.0 ([#581](https://github.com/yargs/yargs/issues/581)) ([882a127](https://github.com/yargs/yargs/commit/882a127))
|
|
91
121
|
|
|
92
122
|
|
|
@@ -102,6 +132,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
102
132
|
* yargs-parser now better handles negative integer values, at the cost of handling numeric option names, e.g., -1 hello
|
|
103
133
|
* default: removed undocumented `defaults` alias for `default`.
|
|
104
134
|
* introduces a default `help` command which outputs help, as an alternative to a help flag.
|
|
135
|
+
* interpret demand() numbers as relative to executing command ([#582](https://github.com/yargs/yargs/issues/582)) ([927810c](https://github.com/yargs/yargs/commit/927810c))
|
|
105
136
|
|
|
106
137
|
|
|
107
138
|
|
package/README.md
CHANGED
|
@@ -1341,6 +1341,8 @@ Locales currently supported:
|
|
|
1341
1341
|
* **en:** American English.
|
|
1342
1342
|
* **es:** Spanish.
|
|
1343
1343
|
* **fr:** French.
|
|
1344
|
+
* **hi:** Hindi.
|
|
1345
|
+
* **hu:** Hungarian.
|
|
1344
1346
|
* **id:** Indonesian.
|
|
1345
1347
|
* **it:** Italian.
|
|
1346
1348
|
* **ja:** Japanese.
|
|
@@ -1350,8 +1352,10 @@ Locales currently supported:
|
|
|
1350
1352
|
* **pl:** Polish.
|
|
1351
1353
|
* **pt:** Portuguese.
|
|
1352
1354
|
* **pt_BR:** Brazilian Portuguese.
|
|
1355
|
+
* **ru:** Russian.
|
|
1356
|
+
* **th:** Thai.
|
|
1353
1357
|
* **tr:** Turkish.
|
|
1354
|
-
* **
|
|
1358
|
+
* **zh_CN:** Chinese.
|
|
1355
1359
|
|
|
1356
1360
|
To submit a new translation for yargs:
|
|
1357
1361
|
|
package/lib/command.js
CHANGED
|
@@ -134,6 +134,7 @@ module.exports = function (yargs, usage, validation) {
|
|
|
134
134
|
var commandHandler = handlers[command] || handlers[aliasMap[command]]
|
|
135
135
|
var innerArgv = argv
|
|
136
136
|
var currentContext = yargs.getContext()
|
|
137
|
+
var numFiles = currentContext.files.length
|
|
137
138
|
var parentCommands = currentContext.commands.slice()
|
|
138
139
|
currentContext.commands.push(command)
|
|
139
140
|
if (typeof commandHandler.builder === 'function') {
|
|
@@ -168,6 +169,8 @@ module.exports = function (yargs, usage, validation) {
|
|
|
168
169
|
commandHandler.handler(innerArgv)
|
|
169
170
|
}
|
|
170
171
|
currentContext.commands.pop()
|
|
172
|
+
numFiles = currentContext.files.length - numFiles
|
|
173
|
+
if (numFiles > 0) currentContext.files.splice(numFiles * -1, numFiles)
|
|
171
174
|
return innerArgv
|
|
172
175
|
}
|
|
173
176
|
|
package/locales/it.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"required": "richiesto",
|
|
11
11
|
"default:": "predefinito:",
|
|
12
12
|
"choices:": "scelte:",
|
|
13
|
+
"aliases:": "alias:",
|
|
13
14
|
"generated-value": "valore generato",
|
|
14
15
|
"Not enough non-option arguments: got %s, need at least %s": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s",
|
|
15
16
|
"Too many non-option arguments: got %s, maximum of %s": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s",
|
|
@@ -33,5 +34,6 @@
|
|
|
33
34
|
"Invalid JSON config file: %s": "File di configurazione JSON non valido: %s",
|
|
34
35
|
"Path to JSON config file": "Percorso del file di configurazione JSON",
|
|
35
36
|
"Show help": "Mostra la schermata di aiuto",
|
|
36
|
-
"Show version number": "Mostra il numero di versione"
|
|
37
|
+
"Show version number": "Mostra il numero di versione",
|
|
38
|
+
"Did you mean %s?": "Intendi forse %s?"
|
|
37
39
|
}
|
package/locales/pt_BR.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"required": "obrigatório",
|
|
11
11
|
"default:": "padrão:",
|
|
12
12
|
"choices:": "opções:",
|
|
13
|
+
"aliases:": "sinônimos:",
|
|
13
14
|
"generated-value": "valor-gerado",
|
|
14
15
|
"Not enough non-option arguments: got %s, need at least %s": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s",
|
|
15
16
|
"Too many non-option arguments: got %s, maximum of %s": "Excesso de argumentos: recebido %s, máximo de %s",
|
|
@@ -33,5 +34,6 @@
|
|
|
33
34
|
"Invalid JSON config file: %s": "Arquivo JSON de configuração inválido: %s",
|
|
34
35
|
"Path to JSON config file": "Caminho para o arquivo JSON de configuração",
|
|
35
36
|
"Show help": "Exibe ajuda",
|
|
36
|
-
"Show version number": "Exibe a versão"
|
|
37
|
+
"Show version number": "Exibe a versão",
|
|
38
|
+
"Did you mean %s?": "Você quis dizer %s?"
|
|
37
39
|
}
|
package/locales/th.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Commands:": "คอมมาน",
|
|
3
|
+
"Options:": "ออฟชั่น",
|
|
4
|
+
"Examples:": "ตัวอย่าง",
|
|
5
|
+
"boolean": "บูลีน",
|
|
6
|
+
"count": "นับ",
|
|
7
|
+
"string": "สตริง",
|
|
8
|
+
"number": "ตัวเลข",
|
|
9
|
+
"array": "อาเรย์",
|
|
10
|
+
"required": "จำเป็น",
|
|
11
|
+
"default:": "ค่าเริ่มต้น",
|
|
12
|
+
"choices:": "ตัวเลือก",
|
|
13
|
+
"aliases:": "เอเลียส",
|
|
14
|
+
"generated-value": "ค่าที่ถูกสร้างขึ้น",
|
|
15
|
+
"Not enough non-option arguments: got %s, need at least %s": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า",
|
|
16
|
+
"Too many non-option arguments: got %s, maximum of %s": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า",
|
|
17
|
+
"Missing argument value: %s": {
|
|
18
|
+
"one": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s",
|
|
19
|
+
"other": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s"
|
|
20
|
+
},
|
|
21
|
+
"Missing required argument: %s": {
|
|
22
|
+
"one": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s",
|
|
23
|
+
"other": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s"
|
|
24
|
+
},
|
|
25
|
+
"Unknown argument: %s": {
|
|
26
|
+
"one": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s",
|
|
27
|
+
"other": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s"
|
|
28
|
+
},
|
|
29
|
+
"Invalid values:": "ค่าไม่ถูกต้อง:",
|
|
30
|
+
"Argument: %s, Given: %s, Choices: %s": "อาร์กิวเมนต์: %s, ได้รับ: %s, ตัวเลือก: %s",
|
|
31
|
+
"Argument check failed: %s": "ตรวจสอบพบอาร์กิวเมนต์ที่ไม่ถูกต้อง: %s",
|
|
32
|
+
"Implications failed:": "Implications ไม่สำเร็จ:",
|
|
33
|
+
"Not enough arguments following: %s": "ใส่อาร์กิวเมนต์ไม่ครบ: %s",
|
|
34
|
+
"Invalid JSON config file: %s": "ไฟล์คอนฟิค JSON ไม่ถูกต้อง: %s",
|
|
35
|
+
"Path to JSON config file": "พาทไฟล์คอนฟิค JSON",
|
|
36
|
+
"Show help": "ขอความช่วยเหลือ",
|
|
37
|
+
"Show version number": "แสดงตัวเลขเวอร์ชั่น",
|
|
38
|
+
"Did you mean %s?": "คุณหมายถึง %s?"
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yargs",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "yargs the modern, pirate-themed, successor to optimist.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"files": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"es6-promise": "^4.0.2",
|
|
37
37
|
"hashish": "0.0.4",
|
|
38
38
|
"mocha": "^3.0.1",
|
|
39
|
-
"nyc": "^8.
|
|
39
|
+
"nyc": "^8.3.2",
|
|
40
40
|
"rimraf": "^2.5.0",
|
|
41
41
|
"standard": "^8.2.0",
|
|
42
42
|
"standard-version": "^3.0.0",
|
package/yargs.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const assign = require('./lib/assign')
|
|
1
2
|
const Command = require('./lib/command')
|
|
2
3
|
const Completion = require('./lib/completion')
|
|
3
4
|
const Parser = require('yargs-parser')
|
|
@@ -165,6 +166,8 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
165
166
|
command.unfreeze()
|
|
166
167
|
strict = frozen.strict
|
|
167
168
|
completionCommand = frozen.completionCommand
|
|
169
|
+
parseFn = null
|
|
170
|
+
parseContext = null
|
|
168
171
|
frozen = undefined
|
|
169
172
|
}
|
|
170
173
|
|
|
@@ -422,13 +425,12 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
422
425
|
}
|
|
423
426
|
|
|
424
427
|
var parseFn = null
|
|
428
|
+
var parseContext = null
|
|
425
429
|
self.parse = function (args, shortCircuit, _parseFn) {
|
|
426
|
-
var config = null
|
|
427
|
-
|
|
428
430
|
// a context object can optionally be provided, this allows
|
|
429
431
|
// additional information to be passed to a command handler.
|
|
430
432
|
if (typeof shortCircuit === 'object') {
|
|
431
|
-
|
|
433
|
+
parseContext = shortCircuit
|
|
432
434
|
shortCircuit = _parseFn
|
|
433
435
|
}
|
|
434
436
|
|
|
@@ -447,13 +449,11 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
447
449
|
freeze()
|
|
448
450
|
exitProcess = false
|
|
449
451
|
}
|
|
450
|
-
if (config) self.config(config)
|
|
451
452
|
|
|
452
453
|
var parsed = parseArgs(args, shortCircuit)
|
|
453
454
|
if (parseFn) {
|
|
454
455
|
parseFn(exitError, parsed, output)
|
|
455
456
|
unfreeze()
|
|
456
|
-
parseFn = null
|
|
457
457
|
}
|
|
458
458
|
|
|
459
459
|
return parsed
|
|
@@ -580,7 +580,7 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
580
580
|
}
|
|
581
581
|
self.getGroups = function () {
|
|
582
582
|
// combine explicit and preserved groups. explicit groups should be first
|
|
583
|
-
return
|
|
583
|
+
return assign(groups, preservedGroups)
|
|
584
584
|
}
|
|
585
585
|
|
|
586
586
|
// as long as options.envPrefix is not undefined,
|
|
@@ -823,7 +823,8 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
823
823
|
options.__ = y18n.__
|
|
824
824
|
options.configuration = pkgUp(cwd)['yargs'] || {}
|
|
825
825
|
const parsed = Parser.detailed(args, options)
|
|
826
|
-
|
|
826
|
+
var argv = parsed.argv
|
|
827
|
+
if (parseContext) argv = assign(parseContext, argv)
|
|
827
828
|
var aliases = parsed.aliases
|
|
828
829
|
|
|
829
830
|
argv.$0 = self.$0
|