Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

commander

Package Overview
Dependencies
Maintainers
6
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commander - npm Package Compare versions

Comparing version 5.0.0-1 to 5.0.0-2

13

CHANGELOG.md

@@ -10,2 +10,12 @@ # Changelog

## [5.0.0-2] (2020-02-10)
### Added
- suggest help option along with unknown command error ([#1179])
### Changed
- TypeScript fluent return types changed to be more subclass friendly, return `this` rather than `Command` ([#1180])
## [5.0.0-1] (2020-02-08)

@@ -316,4 +326,7 @@

[#1172]: https://github.com/tj/commander.js/pull/1172
[#1179]: https://github.com/tj/commander.js/pull/1179
[#1180]: https://github.com/tj/commander.js/pull/1180
[Unreleased]: https://github.com/tj/commander.js/compare/master...develop
[5.0.0-2]: https://github.com/tj/commander.js/compare/v5.0.0-1..v5.0.0-2
[5.0.0-1]: https://github.com/tj/commander.js/compare/v5.0.0-0..v5.0.0-1

@@ -320,0 +333,0 @@ [5.0.0-0]: https://github.com/tj/commander.js/compare/v4.1.1..v5.0.0-0

123

index.js

@@ -14,4 +14,4 @@ /**

*
* @param {String} flags
* @param {String} description
* @param {string} flags
* @param {string} description
* @api public

@@ -35,3 +35,3 @@ */

*
* @return {String}
* @return {string}
* @api private

@@ -48,3 +48,3 @@ */

*
* @return {String}
* @return {string}
* @api private

@@ -60,4 +60,4 @@ */

*
* @param {String} arg
* @return {Boolean}
* @param {string} arg
* @return {boolean}
* @api private

@@ -78,5 +78,5 @@ */

* Constructs the CommanderError class
* @param {Number} exitCode suggested exit code which could be used with process.exit
* @param {String} code an id string representing the error
* @param {String} message human-readable description of the error
* @param {number} exitCode suggested exit code which could be used with process.exit
* @param {string} code an id string representing the error
* @param {string} message human-readable description of the error
* @constructor

@@ -98,3 +98,3 @@ */

*
* @param {String} [name]
* @param {string} [name]
* @api public

@@ -344,5 +344,5 @@ */

*
* @param {Number} exitCode exit code for using with process.exit
* @param {String} code an id string representing the error
* @param {String} message human-readable description of the error
* @param {number} exitCode exit code for using with process.exit
* @param {string} code an id string representing the error
* @param {string} message human-readable description of the error
* @return never

@@ -408,4 +408,4 @@ * @api private

* @param {Object} config
* @param {String} flags
* @param {String} description
* @param {string} flags
* @param {string} description
* @param {Function|*} [fn] - custom option processing function or default vaue

@@ -527,4 +527,4 @@ * @param {*} [defaultValue]

*
* @param {String} flags
* @param {String} description
* @param {string} flags
* @param {string} description
* @param {Function|*} [fn] - custom option processing function or default vaue

@@ -546,4 +546,4 @@ * @param {*} [defaultValue]

*
* @param {String} flags
* @param {String} description
* @param {string} flags
* @param {string} description
* @param {Function|*} [fn] - custom option processing function or default vaue

@@ -562,3 +562,3 @@ * @param {*} [defaultValue]

*
* @param {Boolean} arg if `true` or omitted, no error will be thrown
* @param {Boolean} [arg] - if `true` or omitted, no error will be thrown
* for unknown options.

@@ -606,3 +606,3 @@ * @api public

*
* @param {String} key
* @param {string} key
* @param {Object} value

@@ -623,3 +623,3 @@ * @api private

*
* @param {String} key
* @param {string} key
* @return {Object} value

@@ -728,3 +728,3 @@ * @api private

this.parse(argv, parseOptions);
return Promise.all(this._actionResults);
return Promise.all(this._actionResults).then(() => this);
};

@@ -927,3 +927,3 @@

*
* @param {String} arg
* @param {string} arg
* @return {Option}

@@ -1078,3 +1078,3 @@ * @api private

*
* @param {String} name
* @param {string} name
* @api private

@@ -1093,3 +1093,3 @@ */

* @param {Option} option
* @param {String} [flag]
* @param {string} [flag]
* @api private

@@ -1125,3 +1125,3 @@ */

*
* @param {String} flag
* @param {string} flag
* @api private

@@ -1140,3 +1140,3 @@ */

*
* @param {String} flag
* @param {string} flag
* @api private

@@ -1146,3 +1146,8 @@ */

unknownCommand() {
const message = `error: unknown command '${this.args[0]}'`;
const partCommands = [this.name()];
for (let parentCmd = this.parent; parentCmd; parentCmd = parentCmd.parent) {
partCommands.unshift(parentCmd.name());
}
const fullCommand = partCommands.join(' ');
const message = `error: unknown command '${this.args[0]}'. See '${fullCommand} ${this._helpLongFlag}'.`;
console.error(message);

@@ -1160,5 +1165,5 @@ this._exit(1, 'commander.unknownCommand', message);

*
* @param {String} str
* @param {String} [flags]
* @param {String} [description]
* @param {string} str
* @param {string} [flags]
* @param {string} [description]
* @return {Command} for chaining

@@ -1186,3 +1191,3 @@ * @api public

*
* @param {String} str
* @param {string} str
* @param {Object} [argsDescription]

@@ -1203,3 +1208,3 @@ * @return {String|Command}

*
* @param {String} alias
* @param {string} alias
* @return {String|Command}

@@ -1226,3 +1231,3 @@ * @api public

*
* @param {String} [str]
* @param {string} [str]
* @return {String|Command}

@@ -1250,3 +1255,3 @@ * @api public

*
* @param {String} [str]
* @param {string} [str]
* @return {String|Command}

@@ -1295,3 +1300,3 @@ * @api public

*
* @return {Number}
* @return {number}
* @api private

@@ -1310,3 +1315,3 @@ */

*
* @return {Number}
* @return {number}
* @api private

@@ -1329,3 +1334,3 @@ */

*
* @return {Number}
* @return {number}
* @api private

@@ -1343,3 +1348,3 @@ */

*
* @return {Number}
* @return {number}
* @api private

@@ -1368,3 +1373,3 @@ */

*
* @return {String}
* @return {string}
* @api private

@@ -1391,3 +1396,3 @@ */

*
* @return {String}
* @return {string}
* @api private

@@ -1418,3 +1423,3 @@ */

*
* @return {String}
* @return {string}
* @api public

@@ -1502,4 +1507,4 @@ */

*
* @param {String} [flags]
* @param {String} [description]
* @param {string} [flags]
* @param {string} [description]
* @return {Command}

@@ -1566,4 +1571,4 @@ * @api public

*
* @param {String} flag
* @return {String}
* @param {string} flag
* @return {string}
* @api private

@@ -1581,5 +1586,5 @@ */

*
* @param {String} str
* @param {Number} width
* @return {String}
* @param {string} str
* @param {number} width
* @return {string}
* @api private

@@ -1597,6 +1602,6 @@ */

*
* @param {String} str
* @param {Number} width
* @param {Number} indent
* @return {String}
* @param {string} str
* @param {number} width
* @param {number} indent
* @return {string}
* @api private

@@ -1620,6 +1625,6 @@ */

*
* @param {String} str
* @param {Number} width
* @param {Number} indent
* @return {String}
* @param {string} str
* @param {number} width
* @param {number} indent
* @return {string}
* @api private

@@ -1659,3 +1664,3 @@ */

* @param {Object} arg
* @return {String}
* @return {string}
* @api private

@@ -1662,0 +1667,0 @@ */

{
"name": "commander",
"version": "5.0.0-1",
"version": "5.0.0-2",
"description": "the complete solution for node.js command-line programs",

@@ -5,0 +5,0 @@ "keywords": [

@@ -43,3 +43,3 @@ // Type definitions for commander

*/
version(str: string, flags?: string, description?: string): Command;
version(str: string, flags?: string, description?: string): this;

@@ -85,3 +85,3 @@ /**

*/
command(nameAndArgs: string, description: string, opts?: commander.CommandOptions): Command;
command(nameAndArgs: string, description: string, opts?: commander.CommandOptions): this;

@@ -93,3 +93,3 @@ /**

*/
addCommand(cmd: Command): Command;
addCommand(cmd: Command): this;

@@ -101,3 +101,3 @@ /**

*/
arguments(desc: string): Command;
arguments(desc: string): this;

@@ -107,3 +107,3 @@ /**

*/
exitOverride(callback?: (err: CommanderError) => never|void): Command;
exitOverride(callback?: (err: CommanderError) => never|void): this;

@@ -123,3 +123,3 @@ /**

*/
action(fn: (...args: any[]) => void | Promise<void>): Command;
action(fn: (...args: any[]) => void | Promise<void>): this;

@@ -168,5 +168,5 @@ /**

*/
option(flags: string, description?: string, defaultValue?: string | boolean): Command;
option(flags: string, description: string, regexp: RegExp, defaultValue?: string | boolean): Command;
option<T>(flags: string, description: string, fn: (value: string, previous: T) => T, defaultValue?: T): Command;
option(flags: string, description?: string, defaultValue?: string | boolean): this;
option(flags: string, description: string, regexp: RegExp, defaultValue?: string | boolean): this;
option<T>(flags: string, description: string, fn: (value: string, previous: T) => T, defaultValue?: T): this;

@@ -179,5 +179,5 @@ /**

*/
requiredOption(flags: string, description?: string, defaultValue?: string | boolean): Command;
requiredOption(flags: string, description: string, regexp: RegExp, defaultValue?: string | boolean): Command;
requiredOption<T>(flags: string, description: string, fn: (value: string, previous: T) => T, defaultValue?: T): Command;
requiredOption(flags: string, description?: string, defaultValue?: string | boolean): this;
requiredOption(flags: string, description: string, regexp: RegExp, defaultValue?: string | boolean): this;
requiredOption<T>(flags: string, description: string, fn: (value: string, previous: T) => T, defaultValue?: T): this;

@@ -191,3 +191,3 @@

*/
storeOptionsAsProperties(value?: boolean): Command;
storeOptionsAsProperties(value?: boolean): this;

@@ -200,3 +200,3 @@ /**

*/
passCommandToAction(value?: boolean): Command;
passCommandToAction(value?: boolean): this;

@@ -209,3 +209,3 @@ /**

*/
allowUnknownOption(arg?: boolean): Command;
allowUnknownOption(arg?: boolean): this;

@@ -226,3 +226,3 @@ /**

*/
parse(argv?: string[], options?: ParseOptions): Command;
parse(argv?: string[], options?: ParseOptions): this;

@@ -245,3 +245,3 @@ /**

*/
parseAsync(argv?: string[], options?: ParseOptions): Promise<any>;
parseAsync(argv?: string[], options?: ParseOptions): Promise<this>;

@@ -271,3 +271,3 @@ /**

*/
description(str: string, argsDescription?: {[argName: string]: string}): Command;
description(str: string, argsDescription?: {[argName: string]: string}): this;
/**

@@ -283,3 +283,3 @@ * Get the description.

*/
alias(alias: string): Command;
alias(alias: string): this;
/**

@@ -295,3 +295,3 @@ * Get alias for the command.

*/
usage(str: string): Command;
usage(str: string): this;
/**

@@ -307,3 +307,3 @@ * Get the command usage.

*/
name(str: string): Command;
name(str: string): this;
/**

@@ -331,3 +331,3 @@ * Get the name of the command.

*/
helpOption(flags?: string, description?: string): Command;
helpOption(flags?: string, description?: string): this;

@@ -348,3 +348,3 @@ /**

*/
on(event: string | symbol, listener: (...args: any[]) => void): Command;
on(event: string | symbol, listener: (...args: any[]) => void): this;
}

@@ -351,0 +351,0 @@ type CommandConstructor = { new (name?: string): Command };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc