Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tj/commander.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.18.0
Choose a base ref
...
head repository: tj/commander.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.19.0
Choose a head ref
  • 6 commits
  • 12 files changed
  • 2 contributors

Commits on Sep 15, 2018

  1. Fix to change default value to string

    fixes: #855
    abetomo authored and roman-vanesyan committed Sep 15, 2018
    Copy the full SHA
    4c294c1 View commit details

Commits on Sep 26, 2018

  1. Copy the full SHA
    2c20e91 View commit details

Commits on Oct 1, 2018

  1. Copy the full SHA
    b6549f2 View commit details
  2. Copy the full SHA
    6c0c1f6 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6aafa20 View commit details

Commits on Oct 8, 2018

  1. version bump 2.19.0

    abetomo authored and roman-vanesyan committed Oct 8, 2018
    Copy the full SHA
    78b7dbd View commit details
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@

2.19.0 / 2018-10-02
==================

* Removed newline after Options and Commands headers (#864)
* Bugfix - Error output (#862)
* Fix to change default value to string (#856)

2.18.0 / 2018-09-07
==================

4 changes: 0 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -254,7 +254,6 @@ Usage: pizza [options]
An application for pizzas ordering
Options:
-h, --help output usage information
-V, --version output the version number
-p, --peppers Add peppers
@@ -294,7 +293,6 @@ program
program.on('--help', function(){
console.log('')
console.log('Examples:');
console.log('');
console.log(' $ custom-help --help');
console.log(' $ custom-help -h');
});
@@ -310,15 +308,13 @@ Yields the following help output when `node script-name.js -h` or `node script-n
Usage: custom-help [options]
Options:
-h, --help output usage information
-V, --version output the version number
-f, --foo enable some foo
-b, --bar enable some bar
-B, --baz enable some baz
Examples:
$ custom-help --help
$ custom-help -h
```
10 changes: 3 additions & 7 deletions Readme_zh-CN.md
Original file line number Diff line number Diff line change
@@ -192,7 +192,6 @@ Usage: pizza [options]
An application for pizzas ordering
Options:
-h, --help output usage information
-V, --version output the version number
-p, --peppers Add peppers
@@ -226,10 +225,9 @@ program

program.on('--help', function(){
console.log('');
console.log(' Examples:');
console.log('');
console.log(' $ custom-help --help');
console.log(' $ custom-help -h');
console.log('Examples:');
console.log(' $ custom-help --help');
console.log(' $ custom-help -h');
});

program.parse(process.argv);
@@ -243,15 +241,13 @@ console.log('stuff');
Usage: custom-help [options]
Options:
-h, --help output usage information
-V, --version output the version number
-f, --foo enable some foo
-b, --bar enable some bar
-B, --baz enable some baz
Examples:
$ custom-help --help
$ custom-help -h
```
26 changes: 8 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
@@ -580,9 +580,9 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
proc.on('close', process.exit.bind(process));
proc.on('error', function(err) {
if (err.code === 'ENOENT') {
console.error('%s(1) does not exist, try --help', bin);
console.error('error: %s(1) does not exist, try --help', bin);
} else if (err.code === 'EACCES') {
console.error('%s(1) not executable. try chmod or run with root', bin);
console.error('error: %s(1) not executable. try chmod or run with root', bin);
}
process.exit(1);
});
@@ -792,9 +792,7 @@ Command.prototype.opts = function() {
*/

Command.prototype.missingArgument = function(name) {
console.error();
console.error(" error: missing required argument `%s'", name);
console.error();
console.error("error: missing required argument `%s'", name);
process.exit(1);
};

@@ -807,13 +805,11 @@ Command.prototype.missingArgument = function(name) {
*/

Command.prototype.optionMissingArgument = function(option, flag) {
console.error();
if (flag) {
console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
console.error("error: option `%s' argument missing, got `%s'", option.flags, flag);
} else {
console.error(" error: option `%s' argument missing", option.flags);
console.error("error: option `%s' argument missing", option.flags);
}
console.error();
process.exit(1);
};

@@ -826,9 +822,7 @@ Command.prototype.optionMissingArgument = function(option, flag) {

Command.prototype.unknownOption = function(flag) {
if (this._allowUnknownOption) return;
console.error();
console.error(" error: unknown option `%s'", flag);
console.error();
console.error("error: unknown option `%s'", flag);
process.exit(1);
};

@@ -840,9 +834,7 @@ Command.prototype.unknownOption = function(flag) {
*/

Command.prototype.variadicArgNotLast = function(name) {
console.error();
console.error(" error: variadic arguments must be last `%s'", name);
console.error();
console.error("error: variadic arguments must be last `%s'", name);
process.exit(1);
};

@@ -1053,7 +1045,7 @@ Command.prototype.optionHelp = function() {
// Append the help information
return this.options.map(function(option) {
return pad(option.flags, width) + ' ' + option.description +
((option.bool && option.defaultValue !== undefined) ? ' (default: ' + option.defaultValue + ')' : '');
((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : '');
}).concat([pad('-h, --help', width) + ' ' + 'output usage information'])
.join('\n');
};
@@ -1073,7 +1065,6 @@ Command.prototype.commandHelp = function() {

return [
'Commands:',
'',
commands.map(function(cmd) {
var desc = cmd[1] ? ' ' + cmd[1] : '';
return (desc ? pad(cmd[0], width) : cmd[0]) + desc;
@@ -1124,7 +1115,6 @@ Command.prototype.helpInformation = function() {

var options = [
'Options:',
'',
'' + this.optionHelp().replace(/^/gm, ' '),
''
];
120 changes: 67 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading