yargs 3.23.0 → 3.27.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 +18 -0
- package/README.md +50 -22
- package/index.js +29 -19
- package/lib/parser.js +1 -2
- package/lib/usage.js +10 -5
- package/locales/ja.json +36 -0
- package/locales/zh.json +36 -0
- package/package.json +10 -8
- package/lib/locale.js +0 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
## Change Log
|
|
2
2
|
|
|
3
|
+
### v3.26.0 (2015/09/25 2:14 +00:00)
|
|
4
|
+
|
|
5
|
+
- [#263](https://github.com/bcoe/yargs/pull/263) document count() and option() object keys (@nexdrew)
|
|
6
|
+
- [#259](https://github.com/bcoe/yargs/pull/259) remove util in readme (@38elements)
|
|
7
|
+
- [#258](https://github.com/bcoe/yargs/pull/258) node v4 builds, update deps (@nexdrew)
|
|
8
|
+
- [#257](https://github.com/bcoe/yargs/pull/257) fix spelling errors (@dkoleary88)
|
|
9
|
+
|
|
10
|
+
### v3.25.0 (2015/09/13 7:38 -07:00)
|
|
11
|
+
|
|
12
|
+
- [#254](https://github.com/bcoe/yargs/pull/254) adds Japanese translation (@oti)
|
|
13
|
+
- [#253](https://github.com/bcoe/yargs/pull/253) fixes for tests on Windows (@bcoe)
|
|
14
|
+
|
|
15
|
+
### v3.24.0 (2015/09/04 12:02 +00:00)
|
|
16
|
+
|
|
17
|
+
- [#248](https://github.com/bcoe/yargs/pull/248) reinstate os-locale, no spawning (@nexdrew)
|
|
18
|
+
- [#249](https://github.com/bcoe/yargs/pull/249) use travis container-based infrastructure (@nexdrew)
|
|
19
|
+
- [#247](https://github.com/bcoe/yargs/pull/247) upgrade standard (@nexdrew)
|
|
20
|
+
|
|
3
21
|
### v3.23.0 (2015/08/30 23:00 +00:00)
|
|
4
22
|
|
|
5
23
|
- [#246](https://github.com/bcoe/yargs/pull/246) detect locale based only on environment variables (@bcoe)
|
package/README.md
CHANGED
|
@@ -66,7 +66,6 @@ bool.js:
|
|
|
66
66
|
|
|
67
67
|
````javascript
|
|
68
68
|
#!/usr/bin/env node
|
|
69
|
-
var util = require('util');
|
|
70
69
|
var argv = require('yargs').argv;
|
|
71
70
|
|
|
72
71
|
if (argv.s) {
|
|
@@ -180,7 +179,7 @@ console.log("The area is:", argv.w * argv.h);
|
|
|
180
179
|
|
|
181
180
|
Missing required arguments: h
|
|
182
181
|
|
|
183
|
-
After yer demands have been met, demand more! Ask for non-
|
|
182
|
+
After yer demands have been met, demand more! Ask for non-hyphenated arguments!
|
|
184
183
|
-----------------------------------------
|
|
185
184
|
|
|
186
185
|
demand_count.js:
|
|
@@ -367,7 +366,7 @@ require('yargs').parse([ '-x', '1', '-y', '2' ])
|
|
|
367
366
|
|
|
368
367
|
The rest of these methods below come in just before the terminating `.argv`.
|
|
369
368
|
|
|
370
|
-
|
|
369
|
+
<a name="alias"></a>.alias(key, alias)
|
|
371
370
|
------------------
|
|
372
371
|
|
|
373
372
|
Set key names as equivalent such that updates to a key will propagate to aliases
|
|
@@ -387,18 +386,18 @@ Arguments without a corresponding flag show up in the `argv._` array.
|
|
|
387
386
|
The script name or node command is available at `argv.$0` similarly to how `$0`
|
|
388
387
|
works in bash or perl.
|
|
389
388
|
|
|
390
|
-
If `yargs` is executed in an environment that embeds node and there's no script name (e.g.
|
|
391
|
-
(http://electron.atom.io/) or [nw.js](http://nwjs.io/)), it will ignore the first parameter since it
|
|
389
|
+
If `yargs` is executed in an environment that embeds node and there's no script name (e.g.
|
|
390
|
+
[Electron](http://electron.atom.io/) or [nw.js](http://nwjs.io/)), it will ignore the first parameter since it
|
|
392
391
|
expects it to be the script name. In order to override this behavior, use `.parse(process.argv.slice(1))`
|
|
393
392
|
instead of `.argv` and the first parameter won't be ignored.
|
|
394
393
|
|
|
395
|
-
|
|
394
|
+
<a name="array"></a>.array(key)
|
|
396
395
|
----------
|
|
397
396
|
|
|
398
397
|
Tell the parser to interpret `key` as an array. If `.array('foo')` is set,
|
|
399
398
|
`--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`.
|
|
400
399
|
|
|
401
|
-
|
|
400
|
+
<a name="boolean"></a>.boolean(key)
|
|
402
401
|
-------------
|
|
403
402
|
|
|
404
403
|
Interpret `key` as a boolean. If a non-flag option follows `key` in
|
|
@@ -419,7 +418,7 @@ Check that certain conditions are met in the provided arguments.
|
|
|
419
418
|
If `fn` throws or returns a non-truthy value, show the thrown error, usage information, and
|
|
420
419
|
exit.
|
|
421
420
|
|
|
422
|
-
|
|
421
|
+
<a name="choices"></a>.choices(key, choices)
|
|
423
422
|
----------------------
|
|
424
423
|
|
|
425
424
|
Limit valid values for `key` to a predefined set of `choices`, given as an array
|
|
@@ -530,7 +529,7 @@ var argv = require('yargs')
|
|
|
530
529
|
.argv;
|
|
531
530
|
```
|
|
532
531
|
|
|
533
|
-
|
|
532
|
+
<a name="config"></a>.config(key, [description])
|
|
534
533
|
------------
|
|
535
534
|
|
|
536
535
|
Tells the parser that if the option specified by `key` is passed in, it
|
|
@@ -539,7 +538,13 @@ and parsed, and its properties are set as arguments. If present, the
|
|
|
539
538
|
`description` parameter customizes the description of the config (`key`) option
|
|
540
539
|
in the usage string.
|
|
541
540
|
|
|
542
|
-
|
|
541
|
+
<a name="count"></a>.count(key)
|
|
542
|
+
------------
|
|
543
|
+
|
|
544
|
+
Interpret `key` as a boolean flag, but set its parsed value to the number of
|
|
545
|
+
flag occurrences rather than `true` or `false`. Default value is thus `0`.
|
|
546
|
+
|
|
547
|
+
<a name="default"></a>.default(key, value, [description])
|
|
543
548
|
--------------------
|
|
544
549
|
|
|
545
550
|
Set `argv[key]` to `value` if no option was specified in `process.argv`.
|
|
@@ -563,7 +568,7 @@ displaying the value in the usage instructions:
|
|
|
563
568
|
.default('timeout', 60000, '(one-minute)')
|
|
564
569
|
```
|
|
565
570
|
|
|
566
|
-
<a name="demand
|
|
571
|
+
<a name="demand"></a>.demand(key, [msg | boolean])
|
|
567
572
|
------------------------------
|
|
568
573
|
.demand(count, [max], [msg])
|
|
569
574
|
------------------------------
|
|
@@ -583,13 +588,18 @@ instead of the standard error message. This is especially helpful for the non-op
|
|
|
583
588
|
If a `boolean` value is given, it controls whether the option is demanded;
|
|
584
589
|
this is useful when using `.options()` to specify command line parameters.
|
|
585
590
|
|
|
586
|
-
|
|
591
|
+
<a name="describe"></a>.describe(key, desc)
|
|
587
592
|
--------------------
|
|
588
593
|
|
|
589
594
|
Describe a `key` for the generated usage information.
|
|
590
595
|
|
|
591
596
|
Optionally `.describe()` can take an object that maps keys to descriptions.
|
|
592
597
|
|
|
598
|
+
.detectLocale(boolean)
|
|
599
|
+
-----------
|
|
600
|
+
|
|
601
|
+
Should yargs attempt to detect the os' locale? Defaults to `true`.
|
|
602
|
+
|
|
593
603
|
.epilog(str)
|
|
594
604
|
------------
|
|
595
605
|
.epilogue(str)
|
|
@@ -709,7 +719,9 @@ Locales currently supported:
|
|
|
709
719
|
* **en:** American English.
|
|
710
720
|
* **es:** Spanish.
|
|
711
721
|
* **fr:** French.
|
|
722
|
+
* **ja:** Japanese.
|
|
712
723
|
* **pt:** Portuguese.
|
|
724
|
+
* **zh:** Chinese.
|
|
713
725
|
* **pirate:** American Pirate.
|
|
714
726
|
|
|
715
727
|
To submit a new translation for yargs:
|
|
@@ -717,12 +729,7 @@ To submit a new translation for yargs:
|
|
|
717
729
|
1. use `./locales/en.json` as a starting point.
|
|
718
730
|
2. submit a pull request with the new locale file.
|
|
719
731
|
|
|
720
|
-
|
|
721
|
-
-----------
|
|
722
|
-
|
|
723
|
-
Should yargs attempt to detect the os' locale? defaults to `true`.
|
|
724
|
-
|
|
725
|
-
.nargs(key, count)
|
|
732
|
+
<a name="nargs"></a>.nargs(key, count)
|
|
726
733
|
-----------
|
|
727
734
|
|
|
728
735
|
The number of arguments that should be consumed after a key. This can be a
|
|
@@ -793,6 +800,27 @@ var argv = require('yargs')
|
|
|
793
800
|
;
|
|
794
801
|
````
|
|
795
802
|
|
|
803
|
+
Valid `opt` keys include:
|
|
804
|
+
|
|
805
|
+
- `alias`: string or array of strings, alias(es) for the canonical option key, see [`alias()`](#alias)
|
|
806
|
+
- `array`: boolean, interpret option as an array, see [`array()`](#array)
|
|
807
|
+
- `boolean`: boolean, interpret option as a boolean flag, see [`boolean()`](#boolean)
|
|
808
|
+
- `choices`: value or array of values, limit valid option arguments to a predefined set, see [`choices()`](#choices)
|
|
809
|
+
- `config`: boolean, interpret option as a path to a JSON config file, see [`config()`](#config)
|
|
810
|
+
- `count`: boolean, interpret option as a count of boolean flags, see [`count()`](#count)
|
|
811
|
+
- `default`: value, set a default value for the option, see [`default()`](#default)
|
|
812
|
+
- `defaultDescription`: string, use this description for the default value in help content, see [`default()`](#default)
|
|
813
|
+
- `demand`/`require`/`required`: boolean or string, demand the option be given, with optional error message, see [`demand()`](#demand)
|
|
814
|
+
- `desc`/`describe`/`description`: string, the option description for help content, see [`describe()`](#describe)
|
|
815
|
+
- `nargs`: number, specify how many arguments should be consumed for the option, see [`nargs()`](#nargs)
|
|
816
|
+
- `requiresArg`: boolean, require the option be specified with a value, see [`requiresArg()`](#requiresArg)
|
|
817
|
+
- `string`: boolean, interpret option as a string, see [`string()`](#string)
|
|
818
|
+
- `type`: one of the following strings
|
|
819
|
+
- `'array'`: synonymous for `array: true`, see [`array()`](#array)
|
|
820
|
+
- `'boolean'`: synonymous for `boolean: true`, see [`boolean()`](#boolean)
|
|
821
|
+
- `'count'`: synonymous for `count: true`, see [`count()`](#count)
|
|
822
|
+
- `'string'`: synonymous for `string: true`, see [`string()`](#string)
|
|
823
|
+
|
|
796
824
|
.parse(args)
|
|
797
825
|
------------
|
|
798
826
|
|
|
@@ -803,9 +831,9 @@ Parse `args` instead of `process.argv`. Returns the `argv` object.
|
|
|
803
831
|
.required(key, [msg | boolean])
|
|
804
832
|
------------------------------
|
|
805
833
|
|
|
806
|
-
An alias for [`demand()`](#demand
|
|
834
|
+
An alias for [`demand()`](#demand). See docs there.
|
|
807
835
|
|
|
808
|
-
|
|
836
|
+
<a name="requiresArg"></a>.requiresArg(key)
|
|
809
837
|
-----------------
|
|
810
838
|
|
|
811
839
|
Specifies either a single option key (string), or an array of options that
|
|
@@ -919,7 +947,7 @@ Specify --help for available options
|
|
|
919
947
|
Any command-line argument given that is not demanded, or does not have a
|
|
920
948
|
corresponding description, will be reported as an error.
|
|
921
949
|
|
|
922
|
-
|
|
950
|
+
<a name="string"></a>.string(key)
|
|
923
951
|
------------
|
|
924
952
|
|
|
925
953
|
Tell the parser logic not to interpret `key` as a number or boolean.
|
|
@@ -1016,7 +1044,7 @@ Use `--` to stop parsing flags and stuff the remainder into `argv._`.
|
|
|
1016
1044
|
negate fields
|
|
1017
1045
|
-------------
|
|
1018
1046
|
|
|
1019
|
-
If you want to
|
|
1047
|
+
If you want to explicitly set a field to false instead of just leaving it
|
|
1020
1048
|
undefined or to override a default you can do `--no-key`.
|
|
1021
1049
|
|
|
1022
1050
|
$ node examples/reflect.js -a --no-b
|
package/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
var assert = require('assert')
|
|
2
2
|
var Completion = require('./lib/completion')
|
|
3
|
-
var locale = require('./lib/locale')
|
|
4
3
|
var Parser = require('./lib/parser')
|
|
5
4
|
var path = require('path')
|
|
6
5
|
var Usage = require('./lib/usage')
|
|
@@ -31,8 +30,7 @@ function Argv (processArgs, cwd) {
|
|
|
31
30
|
// bin file with #!/usr/bin/env node
|
|
32
31
|
if (i === 0 && /\b(node|iojs)$/.test(x)) return
|
|
33
32
|
var b = rebase(cwd, x)
|
|
34
|
-
return x.match(/^\//) && b.length < x.length
|
|
35
|
-
? b : x
|
|
33
|
+
return x.match(/^\//) && b.length < x.length ? b : x
|
|
36
34
|
})
|
|
37
35
|
.join(' ').trim()
|
|
38
36
|
|
|
@@ -513,13 +511,16 @@ function Argv (processArgs, cwd) {
|
|
|
513
511
|
return
|
|
514
512
|
}
|
|
515
513
|
|
|
514
|
+
var helpOrVersion = false
|
|
516
515
|
Object.keys(argv).forEach(function (key) {
|
|
517
516
|
if (key === helpOpt && argv[key]) {
|
|
517
|
+
helpOrVersion = true
|
|
518
518
|
self.showHelp('log')
|
|
519
519
|
if (exitProcess) {
|
|
520
520
|
process.exit(0)
|
|
521
521
|
}
|
|
522
522
|
} else if (key === versionOpt && argv[key]) {
|
|
523
|
+
helpOrVersion = true
|
|
523
524
|
usage.showVersion()
|
|
524
525
|
if (exitProcess) {
|
|
525
526
|
process.exit(0)
|
|
@@ -527,18 +528,22 @@ function Argv (processArgs, cwd) {
|
|
|
527
528
|
}
|
|
528
529
|
})
|
|
529
530
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
validation.
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
531
|
+
// If the help or version options where used and exitProcess is false,
|
|
532
|
+
// we won't run validations
|
|
533
|
+
if (!helpOrVersion) {
|
|
534
|
+
if (parsed.error) throw parsed.error
|
|
535
|
+
|
|
536
|
+
// if we're executed via bash completion, don't
|
|
537
|
+
// bother with validation.
|
|
538
|
+
if (!argv[completion.completionKey]) {
|
|
539
|
+
validation.nonOptionCount(argv)
|
|
540
|
+
validation.missingArgumentValue(argv)
|
|
541
|
+
validation.requiredArguments(argv)
|
|
542
|
+
if (strict) validation.unknownArguments(argv, aliases)
|
|
543
|
+
validation.customChecks(argv, aliases)
|
|
544
|
+
validation.limitedChoices(argv)
|
|
545
|
+
validation.implications(argv)
|
|
546
|
+
}
|
|
542
547
|
}
|
|
543
548
|
|
|
544
549
|
setPlaceholderKeys(argv)
|
|
@@ -548,7 +553,14 @@ function Argv (processArgs, cwd) {
|
|
|
548
553
|
|
|
549
554
|
function guessLocale () {
|
|
550
555
|
if (!detectLocale) return
|
|
551
|
-
|
|
556
|
+
|
|
557
|
+
try {
|
|
558
|
+
var osLocale = require('os-locale')
|
|
559
|
+
self.locale(osLocale.sync({ spawn: false }))
|
|
560
|
+
} catch (err) {
|
|
561
|
+
// if we explode looking up locale just noop
|
|
562
|
+
// we'll keep using the default language 'en'.
|
|
563
|
+
}
|
|
552
564
|
}
|
|
553
565
|
|
|
554
566
|
function setPlaceholderKeys (argv) {
|
|
@@ -580,9 +592,7 @@ function sigletonify (inst) {
|
|
|
580
592
|
if (key === 'argv') {
|
|
581
593
|
Argv.__defineGetter__(key, inst.__lookupGetter__(key))
|
|
582
594
|
} else {
|
|
583
|
-
Argv[key] = typeof inst[key] === 'function'
|
|
584
|
-
? inst[key].bind(inst)
|
|
585
|
-
: inst[key]
|
|
595
|
+
Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]
|
|
586
596
|
}
|
|
587
597
|
})
|
|
588
598
|
}
|
package/lib/parser.js
CHANGED
|
@@ -304,8 +304,7 @@ module.exports = function (args, opts, y18n) {
|
|
|
304
304
|
})
|
|
305
305
|
|
|
306
306
|
argv.__defineGetter__(key, function () {
|
|
307
|
-
return typeof val === 'string' ?
|
|
308
|
-
path.normalize(val) : val
|
|
307
|
+
return typeof val === 'string' ? path.normalize(val) : val
|
|
309
308
|
})
|
|
310
309
|
})
|
|
311
310
|
break
|
package/lib/usage.js
CHANGED
|
@@ -28,17 +28,22 @@ module.exports = function (yargs, y18n) {
|
|
|
28
28
|
return self
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
var failureOutput = false
|
|
31
32
|
self.fail = function (msg) {
|
|
32
33
|
if (fails.length) {
|
|
33
34
|
fails.forEach(function (f) {
|
|
34
35
|
f(msg)
|
|
35
36
|
})
|
|
36
37
|
} else {
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
console.error(
|
|
38
|
+
// don't output failure message more than once
|
|
39
|
+
if (!failureOutput) {
|
|
40
|
+
failureOutput = true
|
|
41
|
+
if (showHelpOnFail) yargs.showHelp('error')
|
|
42
|
+
if (msg) console.error(msg)
|
|
43
|
+
if (failMessage) {
|
|
44
|
+
if (msg) console.error('')
|
|
45
|
+
console.error(failMessage)
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
if (yargs.getExitProcess()) {
|
|
44
49
|
process.exit(1)
|
package/locales/ja.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Commands:": "コマンド:",
|
|
3
|
+
"Options:": "オプション:",
|
|
4
|
+
"Examples:": "例:",
|
|
5
|
+
"boolean": "真偽",
|
|
6
|
+
"count": "カウント",
|
|
7
|
+
"string": "文字列",
|
|
8
|
+
"array": "配列",
|
|
9
|
+
"required": "必須",
|
|
10
|
+
"default:": "デフォルト:",
|
|
11
|
+
"choices:": "選択してください:",
|
|
12
|
+
"generated-value": "生成された値",
|
|
13
|
+
"Not enough non-option arguments: got %s, need at least %s": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:",
|
|
14
|
+
"Too many non-option arguments: got %s, maximum of %s": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:",
|
|
15
|
+
"Missing argument value: %s": {
|
|
16
|
+
"one": "引数が見つかりません: %s",
|
|
17
|
+
"other": "引数が見つかりません: %s"
|
|
18
|
+
},
|
|
19
|
+
"Missing required argument: %s": {
|
|
20
|
+
"one": "必須の引数が見つかりません: %s",
|
|
21
|
+
"other": "必須の引数が見つかりません: %s"
|
|
22
|
+
},
|
|
23
|
+
"Unknown argument: %s": {
|
|
24
|
+
"one": "未知の引数です: %s",
|
|
25
|
+
"other": "未知の引数です: %s"
|
|
26
|
+
},
|
|
27
|
+
"Invalid values:": "不正な値です:",
|
|
28
|
+
"Argument: %s, Given: %s, Choices: %s": "引数は %s です。指定できるのは %s つです。選択してください: %s",
|
|
29
|
+
"Argument check failed: %s": "引数のチェックに失敗しました: %s",
|
|
30
|
+
"Implications failed:": "オプションの組み合わせで不正が生じました:",
|
|
31
|
+
"Not enough arguments following: %s": "次の引数が不足しています。: %s",
|
|
32
|
+
"Invalid JSON config file: %s": "JSONの設定ファイルが不正です: %s",
|
|
33
|
+
"Path to JSON config file": "JSONの設定ファイルまでのpath",
|
|
34
|
+
"Show help": "ヘルプを表示",
|
|
35
|
+
"Show version number": "バージョンを表示"
|
|
36
|
+
}
|
package/locales/zh.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Commands:": "命令:",
|
|
3
|
+
"Options:": "选项:",
|
|
4
|
+
"Examples:": "示例:",
|
|
5
|
+
"boolean": "boolean",
|
|
6
|
+
"count": "count",
|
|
7
|
+
"string": "string",
|
|
8
|
+
"array": "array",
|
|
9
|
+
"required": "required",
|
|
10
|
+
"default:": "默认值:",
|
|
11
|
+
"choices:": "可选值:",
|
|
12
|
+
"generated-value": "生成的值",
|
|
13
|
+
"Not enough non-option arguments: got %s, need at least %s": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个",
|
|
14
|
+
"Too many non-option arguments: got %s, maximum of %s": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个",
|
|
15
|
+
"Missing argument value: %s": {
|
|
16
|
+
"one": "没有给此选项指定值:%s",
|
|
17
|
+
"other": "没有给这些选项指定值:%s"
|
|
18
|
+
},
|
|
19
|
+
"Missing required argument: %s": {
|
|
20
|
+
"one": "缺少必须的选项:%s",
|
|
21
|
+
"other": "缺少这些必须的选项:%s"
|
|
22
|
+
},
|
|
23
|
+
"Unknown argument: %s": {
|
|
24
|
+
"one": "无法识别的选项:%s",
|
|
25
|
+
"other": "无法识别这些选项:%s"
|
|
26
|
+
},
|
|
27
|
+
"Invalid values:": "无效的选项值:",
|
|
28
|
+
"Argument: %s, Given: %s, Choices: %s": "选项名称: %s, 传入的值: %s, 可选的值:%s",
|
|
29
|
+
"Argument check failed: %s": "选项值验证失败:%s",
|
|
30
|
+
"Implications failed:": "缺少依赖的选项:",
|
|
31
|
+
"Not enough arguments following: %s": "没有提供足够的值给此选项:%s",
|
|
32
|
+
"Invalid JSON config file: %s": "无效的 JSON 配置文件:%s",
|
|
33
|
+
"Path to JSON config file": "JSON 配置文件的路径",
|
|
34
|
+
"Show help": "显示帮助信息",
|
|
35
|
+
"Show version number": "显示版本号"
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yargs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.27.0",
|
|
4
4
|
"description": "Light-weight option parsing with an argv hash. No optstrings attached.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"files": [
|
|
@@ -14,20 +14,22 @@
|
|
|
14
14
|
"camelcase": "^1.2.1",
|
|
15
15
|
"cliui": "^2.1.0",
|
|
16
16
|
"decamelize": "^1.0.0",
|
|
17
|
+
"os-locale": "^1.4.0",
|
|
17
18
|
"window-size": "^0.1.2",
|
|
18
|
-
"y18n": "^3.
|
|
19
|
+
"y18n": "^3.2.0"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
|
-
"chai": "^3.
|
|
22
|
+
"chai": "^3.3.0",
|
|
22
23
|
"coveralls": "^2.11.4",
|
|
23
24
|
"hashish": "0.0.4",
|
|
24
|
-
"mocha": "^2.3.
|
|
25
|
-
"nyc": "^3.
|
|
26
|
-
"standard": "^5.
|
|
25
|
+
"mocha": "^2.3.3",
|
|
26
|
+
"nyc": "^3.2.2",
|
|
27
|
+
"standard": "^5.3.1",
|
|
28
|
+
"which": "^1.1.2",
|
|
29
|
+
"win-spawn": "^2.0.0"
|
|
27
30
|
},
|
|
28
31
|
"scripts": {
|
|
29
|
-
"test": "standard && nyc
|
|
30
|
-
"test-windows": "mocha --timeout=4000",
|
|
32
|
+
"test": "standard && nyc ./node_modules/.bin/_mocha --timeout=4000 --check-leaks",
|
|
31
33
|
"coverage": "nyc report --reporter=text-lcov | coveralls"
|
|
32
34
|
},
|
|
33
35
|
"repository": {
|
package/lib/locale.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// port of https://github.com/sindresorhus/os-locale
|
|
2
|
-
// that only looks at environment variables.
|
|
3
|
-
module.exports = function () {
|
|
4
|
-
return getEnvLocale()
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function getEnvLocale () {
|
|
8
|
-
var env = process.env
|
|
9
|
-
var ret = env.LC_ALL || env.LANGUAGE || env.LANG || env.LC_MESSAGES
|
|
10
|
-
return getLocale(ret)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function getLocale (str) {
|
|
14
|
-
return (str && str.replace(/[.:].*/, '')) || fallback()
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function fallback () {
|
|
18
|
-
return 'en_US'
|
|
19
|
-
}
|