yargs 6.2.0-candidate → 6.4.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 +39 -1
- package/README.md +10 -4
- package/lib/command.js +3 -0
- package/lib/usage.js +1 -1
- package/locales/be.json +39 -0
- package/locales/nl.json +39 -0
- package/locales/ru.json +3 -3
- package/locales/th.json +39 -0
- package/package.json +6 -5
- package/yargs.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,44 @@
|
|
|
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.4.0"></a>
|
|
6
|
+
# [6.4.0](https://github.com/yargs/yargs/compare/v6.3.0...v6.4.0) (2016-11-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **locales:** correct some Russian translations ([#691](https://github.com/yargs/yargs/issues/691)) ([a980671](https://github.com/yargs/yargs/commit/a980671))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **locales:** Added Belarusian translation ([#690](https://github.com/yargs/yargs/issues/690)) ([68dac1f](https://github.com/yargs/yargs/commit/68dac1f))
|
|
17
|
+
* **locales:** Create nl.json ([#687](https://github.com/yargs/yargs/issues/687)) ([46ce1bb](https://github.com/yargs/yargs/commit/46ce1bb))
|
|
18
|
+
* update to yargs-parser that addresses [#598](https://github.com/yargs/yargs/issues/598), [#617](https://github.com/yargs/yargs/issues/617) ([#700](https://github.com/yargs/yargs/issues/700)) ([54cb31d](https://github.com/yargs/yargs/commit/54cb31d))
|
|
19
|
+
* yargs is now passed as the third-argument to fail handler ([#613](https://github.com/yargs/yargs/issues/613)) ([21b74f9](https://github.com/yargs/yargs/commit/21b74f9))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Performance Improvements
|
|
23
|
+
|
|
24
|
+
* normalizing package data is an expensive operation ([#705](https://github.com/yargs/yargs/issues/705)) ([49cf533](https://github.com/yargs/yargs/commit/49cf533))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
<a name="6.3.0"></a>
|
|
29
|
+
# [6.3.0](https://github.com/yargs/yargs/compare/v6.2.0...v6.3.0) (2016-10-19)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* **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))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
* **locales:** Add Thai locale file ([#679](https://github.com/yargs/yargs/issues/679)) ([c05e36b](https://github.com/yargs/yargs/commit/c05e36b))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
5
43
|
<a name="6.2.0"></a>
|
|
6
44
|
# [6.2.0](https://github.com/yargs/yargs/compare/v6.1.1...v6.2.0) (2016-10-16)
|
|
7
45
|
|
|
@@ -102,7 +140,6 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
102
140
|
* adds recommendCommands() for command suggestions ([#580](https://github.com/yargs/yargs/issues/580)) ([59474dc](https://github.com/yargs/yargs/commit/59474dc))
|
|
103
141
|
* apply .env() globally ([#553](https://github.com/yargs/yargs/issues/553)) ([be65728](https://github.com/yargs/yargs/commit/be65728))
|
|
104
142
|
* 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))
|
|
105
|
-
* interpret demand() numbers as relative to executing command ([#582](https://github.com/yargs/yargs/issues/582)) ([927810c](https://github.com/yargs/yargs/commit/927810c))
|
|
106
143
|
* update yargs-parser to version 3.1.0 ([#581](https://github.com/yargs/yargs/issues/581)) ([882a127](https://github.com/yargs/yargs/commit/882a127))
|
|
107
144
|
|
|
108
145
|
|
|
@@ -118,6 +155,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
118
155
|
* yargs-parser now better handles negative integer values, at the cost of handling numeric option names, e.g., -1 hello
|
|
119
156
|
* default: removed undocumented `defaults` alias for `default`.
|
|
120
157
|
* introduces a default `help` command which outputs help, as an alternative to a help flag.
|
|
158
|
+
* interpret demand() numbers as relative to executing command ([#582](https://github.com/yargs/yargs/issues/582)) ([927810c](https://github.com/yargs/yargs/commit/927810c))
|
|
121
159
|
|
|
122
160
|
|
|
123
161
|
|
package/README.md
CHANGED
|
@@ -1150,15 +1150,17 @@ yargs have been validated.
|
|
|
1150
1150
|
|
|
1151
1151
|
Method to execute when a failure occurs, rather than printing the failure message.
|
|
1152
1152
|
|
|
1153
|
-
`fn` is called with the failure message that would have been printed
|
|
1154
|
-
`Error` instance originally thrown
|
|
1153
|
+
`fn` is called with the failure message that would have been printed, the
|
|
1154
|
+
`Error` instance originally thrown and yargs state when the failure
|
|
1155
|
+
occured.
|
|
1155
1156
|
|
|
1156
1157
|
```js
|
|
1157
1158
|
var argv = require('yargs')
|
|
1158
|
-
.fail(function (msg, err) {
|
|
1159
|
+
.fail(function (msg, err, yargs) {
|
|
1159
1160
|
if (err) throw err // preserve stack
|
|
1160
1161
|
console.error('You broke it!')
|
|
1161
1162
|
console.error(msg)
|
|
1163
|
+
console.error('You should be doing', yargs.help())
|
|
1162
1164
|
process.exit(1)
|
|
1163
1165
|
})
|
|
1164
1166
|
.argv
|
|
@@ -1341,6 +1343,8 @@ Locales currently supported:
|
|
|
1341
1343
|
* **en:** American English.
|
|
1342
1344
|
* **es:** Spanish.
|
|
1343
1345
|
* **fr:** French.
|
|
1346
|
+
* **hi:** Hindi.
|
|
1347
|
+
* **hu:** Hungarian.
|
|
1344
1348
|
* **id:** Indonesian.
|
|
1345
1349
|
* **it:** Italian.
|
|
1346
1350
|
* **ja:** Japanese.
|
|
@@ -1350,8 +1354,10 @@ Locales currently supported:
|
|
|
1350
1354
|
* **pl:** Polish.
|
|
1351
1355
|
* **pt:** Portuguese.
|
|
1352
1356
|
* **pt_BR:** Brazilian Portuguese.
|
|
1357
|
+
* **ru:** Russian.
|
|
1358
|
+
* **th:** Thai.
|
|
1353
1359
|
* **tr:** Turkish.
|
|
1354
|
-
* **
|
|
1360
|
+
* **zh_CN:** Chinese.
|
|
1355
1361
|
|
|
1356
1362
|
To submit a new translation for yargs:
|
|
1357
1363
|
|
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/lib/usage.js
CHANGED
package/locales/be.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:": "Дадзены аргумент патрабуе наступны дадатковы аргумент:",
|
|
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/locales/nl.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Commands:": "Opdrachten:",
|
|
3
|
+
"Options:": "Opties:",
|
|
4
|
+
"Examples:": "Voorbeelden:",
|
|
5
|
+
"boolean": "boolean",
|
|
6
|
+
"count": "aantal",
|
|
7
|
+
"string": "text",
|
|
8
|
+
"number": "nummer",
|
|
9
|
+
"array": "lijst",
|
|
10
|
+
"required": "verplicht",
|
|
11
|
+
"default:": "standaard:",
|
|
12
|
+
"choices:": "keuzes:",
|
|
13
|
+
"aliases:": "aliassen:",
|
|
14
|
+
"generated-value": "gegenereerde waarde",
|
|
15
|
+
"Not enough non-option arguments: got %s, need at least %s": "Niet genoeg non-optie argumenten. Gekregen: %s, minstens nodig: %s",
|
|
16
|
+
"Too many non-option arguments: got %s, maximum of %s": "Te veel non-optie argumenten. Gekregen: %s, maximum: %s",
|
|
17
|
+
"Missing argument value: %s": {
|
|
18
|
+
"one": "Missing argument value: %s",
|
|
19
|
+
"other": "Missing argument values: %s"
|
|
20
|
+
},
|
|
21
|
+
"Missing required argument: %s": {
|
|
22
|
+
"one": "Missend verplichte argument: %s",
|
|
23
|
+
"other": "Missende verplichte argumenten: %s"
|
|
24
|
+
},
|
|
25
|
+
"Unknown argument: %s": {
|
|
26
|
+
"one": "Onbekend argument: %s",
|
|
27
|
+
"other": "Onbekende argumenten: %s"
|
|
28
|
+
},
|
|
29
|
+
"Invalid values:": "Ongeldige waardes:",
|
|
30
|
+
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeven: %s, Keuzes: %s",
|
|
31
|
+
"Argument check failed: %s": "Argument check mislukt: %s",
|
|
32
|
+
"Implications failed:": "Implicaties mislukt:",
|
|
33
|
+
"Not enough arguments following: %s": "Niet genoeg argumenten na: %s",
|
|
34
|
+
"Invalid JSON config file: %s": "Ongeldig JSON configuratiebestand: %s",
|
|
35
|
+
"Path to JSON config file": "Pad naar JSON configuratiebestand",
|
|
36
|
+
"Show help": "Toon help",
|
|
37
|
+
"Show version number": "Toon versie nummer",
|
|
38
|
+
"Did you mean %s?": "Bedoelde u misschien %s?"
|
|
39
|
+
}
|
package/locales/ru.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"Commands:": "
|
|
2
|
+
"Commands:": "Команды:",
|
|
3
3
|
"Options:": "Опции:",
|
|
4
4
|
"Examples:": "Примеры:",
|
|
5
5
|
"boolean": "булевый тип",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"choices:": "возможности:",
|
|
13
13
|
"aliases:": "алиасы:",
|
|
14
14
|
"generated-value": "генерированное значение",
|
|
15
|
-
"Not enough non-option arguments: got %s, need at least %s": "
|
|
15
|
+
"Not enough non-option arguments: got %s, need at least %s": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s",
|
|
16
16
|
"Too many non-option arguments: got %s, maximum of %s": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s",
|
|
17
17
|
"Missing argument value: %s": {
|
|
18
18
|
"one": "Не хватает значения аргумента: %s",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Данное значение: %s, Возможности: %s",
|
|
31
31
|
"Argument check failed: %s": "Проверка аргументов не удалась: %s",
|
|
32
32
|
"Implications failed:": "Данный аргумент требует следующий дополнительный аргумент:",
|
|
33
|
-
"Not enough arguments following: %s": "
|
|
33
|
+
"Not enough arguments following: %s": "Недостаточно следующих аргументов: %s",
|
|
34
34
|
"Invalid JSON config file: %s": "Недействительный файл конфигурации JSON: %s",
|
|
35
35
|
"Path to JSON config file": "Путь к файлу конфигурации JSON",
|
|
36
36
|
"Show help": "Показать помощь",
|
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.4.0",
|
|
4
4
|
"description": "yargs the modern, pirate-themed, successor to optimist.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"files": [
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"which-module": "^1.0.0",
|
|
26
26
|
"window-size": "^0.2.0",
|
|
27
27
|
"y18n": "^3.2.1",
|
|
28
|
-
"yargs-parser": "^4.0
|
|
28
|
+
"yargs-parser": "^4.1.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"chai": "^3.4.1",
|
|
32
32
|
"chalk": "^1.1.3",
|
|
33
33
|
"coveralls": "^2.11.11",
|
|
34
34
|
"cpr": "^2.0.0",
|
|
35
|
-
"cross-spawn": "^
|
|
35
|
+
"cross-spawn": "^5.0.1",
|
|
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",
|
|
@@ -74,7 +74,8 @@
|
|
|
74
74
|
"greenkeeper": {
|
|
75
75
|
"ignore": [
|
|
76
76
|
"string-width",
|
|
77
|
-
"read-pkg-up"
|
|
77
|
+
"read-pkg-up",
|
|
78
|
+
"camelcase"
|
|
78
79
|
]
|
|
79
80
|
}
|
|
80
81
|
}
|
package/yargs.js
CHANGED
|
@@ -416,7 +416,8 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
416
416
|
var obj = {}
|
|
417
417
|
try {
|
|
418
418
|
obj = readPkgUp.sync({
|
|
419
|
-
cwd: path || require('require-main-filename')(parentRequire || require)
|
|
419
|
+
cwd: path || require('require-main-filename')(parentRequire || require),
|
|
420
|
+
normalize: false
|
|
420
421
|
})
|
|
421
422
|
} catch (noop) {}
|
|
422
423
|
|