commander 2.0.0 → 2.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/index.js +6 -2
- package/package.json +2 -1
- package/History.md +0 -179
package/index.js
CHANGED
|
@@ -431,11 +431,16 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
|
|
|
431
431
|
Command.prototype.normalize = function(args){
|
|
432
432
|
var ret = []
|
|
433
433
|
, arg
|
|
434
|
+
, lastOpt
|
|
434
435
|
, index;
|
|
435
436
|
|
|
436
437
|
for (var i = 0, len = args.length; i < len; ++i) {
|
|
437
438
|
arg = args[i];
|
|
438
|
-
|
|
439
|
+
i > 0 && (lastOpt = this.optionFor(args[i-1]));
|
|
440
|
+
|
|
441
|
+
if (lastOpt && lastOpt.required) {
|
|
442
|
+
ret.push(arg);
|
|
443
|
+
} else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
|
|
439
444
|
arg.slice(1).split('').forEach(function(c){
|
|
440
445
|
ret.push('-' + c);
|
|
441
446
|
});
|
|
@@ -544,7 +549,6 @@ Command.prototype.parseOptions = function(argv){
|
|
|
544
549
|
if (option.required) {
|
|
545
550
|
arg = argv[++i];
|
|
546
551
|
if (null == arg) return this.optionMissingArgument(option);
|
|
547
|
-
if ('-' == arg[0] && '-' != arg) return this.optionMissingArgument(option, arg);
|
|
548
552
|
this.emit(option.name(), arg);
|
|
549
553
|
// optional arg
|
|
550
554
|
} else if (option.optional) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commander"
|
|
3
|
-
, "version": "2.
|
|
3
|
+
, "version": "2.1.0"
|
|
4
4
|
, "description": "the complete solution for node.js command-line programs"
|
|
5
5
|
, "keywords": ["command", "option", "parser", "prompt", "stdin"]
|
|
6
6
|
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
|
|
@@ -9,4 +9,5 @@
|
|
|
9
9
|
, "scripts": { "test": "make test" }
|
|
10
10
|
, "main": "index"
|
|
11
11
|
, "engines": { "node": ">= 0.6.x" }
|
|
12
|
+
, "files": ["index.js"]
|
|
12
13
|
}
|
package/History.md
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
2.0.0 / 2013-07-18
|
|
3
|
-
==================
|
|
4
|
-
|
|
5
|
-
* remove input methods (.prompt, .confirm, etc)
|
|
6
|
-
|
|
7
|
-
1.3.2 / 2013-07-18
|
|
8
|
-
==================
|
|
9
|
-
|
|
10
|
-
* add support for sub-commands to co-exist with the original command
|
|
11
|
-
|
|
12
|
-
1.3.1 / 2013-07-18
|
|
13
|
-
==================
|
|
14
|
-
|
|
15
|
-
* add quick .runningCommand hack so you can opt-out of other logic when running a sub command
|
|
16
|
-
|
|
17
|
-
1.3.0 / 2013-07-09
|
|
18
|
-
==================
|
|
19
|
-
|
|
20
|
-
* add EACCES error handling
|
|
21
|
-
* fix sub-command --help
|
|
22
|
-
|
|
23
|
-
1.2.0 / 2013-06-13
|
|
24
|
-
==================
|
|
25
|
-
|
|
26
|
-
* allow "-" hyphen as an option argument
|
|
27
|
-
* support for RegExp coercion
|
|
28
|
-
|
|
29
|
-
1.1.1 / 2012-11-20
|
|
30
|
-
==================
|
|
31
|
-
|
|
32
|
-
* add more sub-command padding
|
|
33
|
-
* fix .usage() when args are present. Closes #106
|
|
34
|
-
|
|
35
|
-
1.1.0 / 2012-11-16
|
|
36
|
-
==================
|
|
37
|
-
|
|
38
|
-
* add git-style executable subcommand support. Closes #94
|
|
39
|
-
|
|
40
|
-
1.0.5 / 2012-10-09
|
|
41
|
-
==================
|
|
42
|
-
|
|
43
|
-
* fix `--name` clobbering. Closes #92
|
|
44
|
-
* fix examples/help. Closes #89
|
|
45
|
-
|
|
46
|
-
1.0.4 / 2012-09-03
|
|
47
|
-
==================
|
|
48
|
-
|
|
49
|
-
* add `outputHelp()` method.
|
|
50
|
-
|
|
51
|
-
1.0.3 / 2012-08-30
|
|
52
|
-
==================
|
|
53
|
-
|
|
54
|
-
* remove invalid .version() defaulting
|
|
55
|
-
|
|
56
|
-
1.0.2 / 2012-08-24
|
|
57
|
-
==================
|
|
58
|
-
|
|
59
|
-
* add `--foo=bar` support [arv]
|
|
60
|
-
* fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
|
|
61
|
-
|
|
62
|
-
1.0.1 / 2012-08-03
|
|
63
|
-
==================
|
|
64
|
-
|
|
65
|
-
* fix issue #56
|
|
66
|
-
* fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
|
|
67
|
-
|
|
68
|
-
1.0.0 / 2012-07-05
|
|
69
|
-
==================
|
|
70
|
-
|
|
71
|
-
* add support for optional option descriptions
|
|
72
|
-
* add defaulting of `.version()` to package.json's version
|
|
73
|
-
|
|
74
|
-
0.6.1 / 2012-06-01
|
|
75
|
-
==================
|
|
76
|
-
|
|
77
|
-
* Added: append (yes or no) on confirmation
|
|
78
|
-
* Added: allow node.js v0.7.x
|
|
79
|
-
|
|
80
|
-
0.6.0 / 2012-04-10
|
|
81
|
-
==================
|
|
82
|
-
|
|
83
|
-
* Added `.prompt(obj, callback)` support. Closes #49
|
|
84
|
-
* Added default support to .choose(). Closes #41
|
|
85
|
-
* Fixed the choice example
|
|
86
|
-
|
|
87
|
-
0.5.1 / 2011-12-20
|
|
88
|
-
==================
|
|
89
|
-
|
|
90
|
-
* Fixed `password()` for recent nodes. Closes #36
|
|
91
|
-
|
|
92
|
-
0.5.0 / 2011-12-04
|
|
93
|
-
==================
|
|
94
|
-
|
|
95
|
-
* Added sub-command option support [itay]
|
|
96
|
-
|
|
97
|
-
0.4.3 / 2011-12-04
|
|
98
|
-
==================
|
|
99
|
-
|
|
100
|
-
* Fixed custom help ordering. Closes #32
|
|
101
|
-
|
|
102
|
-
0.4.2 / 2011-11-24
|
|
103
|
-
==================
|
|
104
|
-
|
|
105
|
-
* Added travis support
|
|
106
|
-
* Fixed: line-buffered input automatically trimmed. Closes #31
|
|
107
|
-
|
|
108
|
-
0.4.1 / 2011-11-18
|
|
109
|
-
==================
|
|
110
|
-
|
|
111
|
-
* Removed listening for "close" on --help
|
|
112
|
-
|
|
113
|
-
0.4.0 / 2011-11-15
|
|
114
|
-
==================
|
|
115
|
-
|
|
116
|
-
* Added support for `--`. Closes #24
|
|
117
|
-
|
|
118
|
-
0.3.3 / 2011-11-14
|
|
119
|
-
==================
|
|
120
|
-
|
|
121
|
-
* Fixed: wait for close event when writing help info [Jerry Hamlet]
|
|
122
|
-
|
|
123
|
-
0.3.2 / 2011-11-01
|
|
124
|
-
==================
|
|
125
|
-
|
|
126
|
-
* Fixed long flag definitions with values [felixge]
|
|
127
|
-
|
|
128
|
-
0.3.1 / 2011-10-31
|
|
129
|
-
==================
|
|
130
|
-
|
|
131
|
-
* Changed `--version` short flag to `-V` from `-v`
|
|
132
|
-
* Changed `.version()` so it's configurable [felixge]
|
|
133
|
-
|
|
134
|
-
0.3.0 / 2011-10-31
|
|
135
|
-
==================
|
|
136
|
-
|
|
137
|
-
* Added support for long flags only. Closes #18
|
|
138
|
-
|
|
139
|
-
0.2.1 / 2011-10-24
|
|
140
|
-
==================
|
|
141
|
-
|
|
142
|
-
* "node": ">= 0.4.x < 0.7.0". Closes #20
|
|
143
|
-
|
|
144
|
-
0.2.0 / 2011-09-26
|
|
145
|
-
==================
|
|
146
|
-
|
|
147
|
-
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
|
|
148
|
-
|
|
149
|
-
0.1.0 / 2011-08-24
|
|
150
|
-
==================
|
|
151
|
-
|
|
152
|
-
* Added support for custom `--help` output
|
|
153
|
-
|
|
154
|
-
0.0.5 / 2011-08-18
|
|
155
|
-
==================
|
|
156
|
-
|
|
157
|
-
* Changed: when the user enters nothing prompt for password again
|
|
158
|
-
* Fixed issue with passwords beginning with numbers [NuckChorris]
|
|
159
|
-
|
|
160
|
-
0.0.4 / 2011-08-15
|
|
161
|
-
==================
|
|
162
|
-
|
|
163
|
-
* Fixed `Commander#args`
|
|
164
|
-
|
|
165
|
-
0.0.3 / 2011-08-15
|
|
166
|
-
==================
|
|
167
|
-
|
|
168
|
-
* Added default option value support
|
|
169
|
-
|
|
170
|
-
0.0.2 / 2011-08-15
|
|
171
|
-
==================
|
|
172
|
-
|
|
173
|
-
* Added mask support to `Command#password(str[, mask], fn)`
|
|
174
|
-
* Added `Command#password(str, fn)`
|
|
175
|
-
|
|
176
|
-
0.0.1 / 2010-01-03
|
|
177
|
-
==================
|
|
178
|
-
|
|
179
|
-
* Initial release
|