commander 2.12.2 → 2.13.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 +8 -0
- package/index.js +3 -3
- package/package.json +1 -1
- package/typings/index.d.ts +19 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
2.13.0 / 2018-01-09
|
|
3
|
+
==================
|
|
4
|
+
|
|
5
|
+
* Do not print default for --no-
|
|
6
|
+
* remove trailing spaces in command help
|
|
7
|
+
* Update CI's Node.js to LTS and latest version
|
|
8
|
+
* typedefs: Command and Option types added to commander namespace
|
|
9
|
+
|
|
2
10
|
2.12.2 / 2017-11-28
|
|
3
11
|
==================
|
|
4
12
|
|
package/index.js
CHANGED
|
@@ -964,7 +964,7 @@ Command.prototype.optionHelp = function() {
|
|
|
964
964
|
// Append the help information
|
|
965
965
|
return this.options.map(function(option) {
|
|
966
966
|
return pad(option.flags, width) + ' ' + option.description
|
|
967
|
-
+ (option.defaultValue !== undefined ? ' (default: ' + option.defaultValue + ')' : '');
|
|
967
|
+
+ ((option.bool != false && option.defaultValue !== undefined) ? ' (default: ' + option.defaultValue + ')' : '');
|
|
968
968
|
}).concat([pad('-h, --help', width) + ' ' + 'output usage information'])
|
|
969
969
|
.join('\n');
|
|
970
970
|
};
|
|
@@ -990,7 +990,7 @@ Command.prototype.commandHelp = function() {
|
|
|
990
990
|
cmd._name
|
|
991
991
|
+ (cmd._alias ? '|' + cmd._alias : '')
|
|
992
992
|
+ (cmd.options.length ? ' [options]' : '')
|
|
993
|
-
+ ' ' + args
|
|
993
|
+
+ (args ? ' ' + args : '')
|
|
994
994
|
, cmd._description
|
|
995
995
|
];
|
|
996
996
|
});
|
|
@@ -1005,7 +1005,7 @@ Command.prototype.commandHelp = function() {
|
|
|
1005
1005
|
, ''
|
|
1006
1006
|
, commands.map(function(cmd) {
|
|
1007
1007
|
var desc = cmd[1] ? ' ' + cmd[1] : '';
|
|
1008
|
-
return pad(cmd[0], width) + desc;
|
|
1008
|
+
return (desc ? pad(cmd[0], width) : cmd[0]) + desc;
|
|
1009
1009
|
}).join('\n').replace(/^/gm, ' ')
|
|
1010
1010
|
, ''
|
|
1011
1011
|
].join('\n');
|
package/package.json
CHANGED
package/typings/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
// Type definitions for commander 2.11
|
|
1
2
|
// Project: https://github.com/visionmedia/commander.js
|
|
2
|
-
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>
|
|
3
|
+
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
|
|
4
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
3
5
|
|
|
4
|
-
declare
|
|
6
|
+
declare namespace local {
|
|
7
|
+
|
|
8
|
+
class Option {
|
|
5
9
|
flags: string;
|
|
6
10
|
required: boolean;
|
|
7
11
|
optional: boolean;
|
|
@@ -17,9 +21,9 @@ declare class Option {
|
|
|
17
21
|
* @param {string} [description]
|
|
18
22
|
*/
|
|
19
23
|
constructor(flags: string, description?: string);
|
|
20
|
-
}
|
|
24
|
+
}
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
class Command extends NodeJS.EventEmitter {
|
|
23
27
|
[key: string]: any;
|
|
24
28
|
|
|
25
29
|
args: string[];
|
|
@@ -121,6 +125,7 @@ declare class Command extends NodeJS.EventEmitter {
|
|
|
121
125
|
* @returns {Command} for chaining
|
|
122
126
|
*/
|
|
123
127
|
parseExpectedArgs(args: string[]): Command;
|
|
128
|
+
|
|
124
129
|
/**
|
|
125
130
|
* Register callback `fn` for the command.
|
|
126
131
|
*
|
|
@@ -262,16 +267,22 @@ declare class Command extends NodeJS.EventEmitter {
|
|
|
262
267
|
/**
|
|
263
268
|
* Output help information for this command.
|
|
264
269
|
*
|
|
265
|
-
* @param {(str: string) => string} [cb]
|
|
270
|
+
* @param {(str: string) => string} [cb]
|
|
266
271
|
*/
|
|
267
272
|
outputHelp(cb?: (str: string) => string): void;
|
|
268
273
|
|
|
269
274
|
/** Output help information and exit. */
|
|
270
275
|
help(): void;
|
|
276
|
+
}
|
|
277
|
+
|
|
271
278
|
}
|
|
272
279
|
|
|
273
280
|
declare namespace commander {
|
|
274
281
|
|
|
282
|
+
type Command = local.Command
|
|
283
|
+
|
|
284
|
+
type Option = local.Option
|
|
285
|
+
|
|
275
286
|
interface CommandOptions {
|
|
276
287
|
noHelp?: boolean;
|
|
277
288
|
isDefault?: boolean;
|
|
@@ -283,8 +294,8 @@ declare namespace commander {
|
|
|
283
294
|
}
|
|
284
295
|
|
|
285
296
|
interface CommanderStatic extends Command {
|
|
286
|
-
Command: typeof Command;
|
|
287
|
-
Option: typeof Option;
|
|
297
|
+
Command: typeof local.Command;
|
|
298
|
+
Option: typeof local.Option;
|
|
288
299
|
CommandOptions: CommandOptions;
|
|
289
300
|
ParseOptionsResult: ParseOptionsResult;
|
|
290
301
|
}
|
|
@@ -292,4 +303,4 @@ declare namespace commander {
|
|
|
292
303
|
}
|
|
293
304
|
|
|
294
305
|
declare const commander: commander.CommanderStatic;
|
|
295
|
-
export = commander;
|
|
306
|
+
export = commander;
|