commander 2.18.0 → 2.19.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 CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ 2.19.0 / 2018-10-02
3
+ ==================
4
+
5
+ * Removed newline after Options and Commands headers (#864)
6
+ * Bugfix - Error output (#862)
7
+ * Fix to change default value to string (#856)
8
+
2
9
  2.18.0 / 2018-09-07
3
10
  ==================
4
11
 
package/Readme.md CHANGED
@@ -254,7 +254,6 @@ Usage: pizza [options]
254
254
  An application for pizzas ordering
255
255
 
256
256
  Options:
257
-
258
257
  -h, --help output usage information
259
258
  -V, --version output the version number
260
259
  -p, --peppers Add peppers
@@ -294,7 +293,6 @@ program
294
293
  program.on('--help', function(){
295
294
  console.log('')
296
295
  console.log('Examples:');
297
- console.log('');
298
296
  console.log(' $ custom-help --help');
299
297
  console.log(' $ custom-help -h');
300
298
  });
@@ -310,7 +308,6 @@ Yields the following help output when `node script-name.js -h` or `node script-n
310
308
  Usage: custom-help [options]
311
309
 
312
310
  Options:
313
-
314
311
  -h, --help output usage information
315
312
  -V, --version output the version number
316
313
  -f, --foo enable some foo
@@ -318,7 +315,6 @@ Options:
318
315
  -B, --baz enable some baz
319
316
 
320
317
  Examples:
321
-
322
318
  $ custom-help --help
323
319
  $ custom-help -h
324
320
  ```
package/index.js CHANGED
@@ -580,9 +580,9 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
580
580
  proc.on('close', process.exit.bind(process));
581
581
  proc.on('error', function(err) {
582
582
  if (err.code === 'ENOENT') {
583
- console.error('%s(1) does not exist, try --help', bin);
583
+ console.error('error: %s(1) does not exist, try --help', bin);
584
584
  } else if (err.code === 'EACCES') {
585
- console.error('%s(1) not executable. try chmod or run with root', bin);
585
+ console.error('error: %s(1) not executable. try chmod or run with root', bin);
586
586
  }
587
587
  process.exit(1);
588
588
  });
@@ -792,9 +792,7 @@ Command.prototype.opts = function() {
792
792
  */
793
793
 
794
794
  Command.prototype.missingArgument = function(name) {
795
- console.error();
796
- console.error(" error: missing required argument `%s'", name);
797
- console.error();
795
+ console.error("error: missing required argument `%s'", name);
798
796
  process.exit(1);
799
797
  };
800
798
 
@@ -807,13 +805,11 @@ Command.prototype.missingArgument = function(name) {
807
805
  */
808
806
 
809
807
  Command.prototype.optionMissingArgument = function(option, flag) {
810
- console.error();
811
808
  if (flag) {
812
- console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
809
+ console.error("error: option `%s' argument missing, got `%s'", option.flags, flag);
813
810
  } else {
814
- console.error(" error: option `%s' argument missing", option.flags);
811
+ console.error("error: option `%s' argument missing", option.flags);
815
812
  }
816
- console.error();
817
813
  process.exit(1);
818
814
  };
819
815
 
@@ -826,9 +822,7 @@ Command.prototype.optionMissingArgument = function(option, flag) {
826
822
 
827
823
  Command.prototype.unknownOption = function(flag) {
828
824
  if (this._allowUnknownOption) return;
829
- console.error();
830
- console.error(" error: unknown option `%s'", flag);
831
- console.error();
825
+ console.error("error: unknown option `%s'", flag);
832
826
  process.exit(1);
833
827
  };
834
828
 
@@ -840,9 +834,7 @@ Command.prototype.unknownOption = function(flag) {
840
834
  */
841
835
 
842
836
  Command.prototype.variadicArgNotLast = function(name) {
843
- console.error();
844
- console.error(" error: variadic arguments must be last `%s'", name);
845
- console.error();
837
+ console.error("error: variadic arguments must be last `%s'", name);
846
838
  process.exit(1);
847
839
  };
848
840
 
@@ -1053,7 +1045,7 @@ Command.prototype.optionHelp = function() {
1053
1045
  // Append the help information
1054
1046
  return this.options.map(function(option) {
1055
1047
  return pad(option.flags, width) + ' ' + option.description +
1056
- ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + option.defaultValue + ')' : '');
1048
+ ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : '');
1057
1049
  }).concat([pad('-h, --help', width) + ' ' + 'output usage information'])
1058
1050
  .join('\n');
1059
1051
  };
@@ -1073,7 +1065,6 @@ Command.prototype.commandHelp = function() {
1073
1065
 
1074
1066
  return [
1075
1067
  'Commands:',
1076
- '',
1077
1068
  commands.map(function(cmd) {
1078
1069
  var desc = cmd[1] ? ' ' + cmd[1] : '';
1079
1070
  return (desc ? pad(cmd[0], width) : cmd[0]) + desc;
@@ -1124,7 +1115,6 @@ Command.prototype.helpInformation = function() {
1124
1115
 
1125
1116
  var options = [
1126
1117
  'Options:',
1127
- '',
1128
1118
  '' + this.optionHelp().replace(/^/gm, ' '),
1129
1119
  ''
1130
1120
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commander",
3
- "version": "2.18.0",
3
+ "version": "2.19.0",
4
4
  "description": "the complete solution for node.js command-line programs",
5
5
  "keywords": [
6
6
  "commander",
@@ -26,10 +26,10 @@
26
26
  ],
27
27
  "dependencies": {},
28
28
  "devDependencies": {
29
- "@types/node": "^10.9.4",
30
- "eslint": "^5.5.0",
29
+ "@types/node": "^10.11.3",
30
+ "eslint": "^5.6.1",
31
31
  "should": "^13.2.3",
32
- "sinon": "^6.2.0",
32
+ "sinon": "^6.3.4",
33
33
  "standard": "^12.0.1",
34
34
  "ts-node": "^7.0.1",
35
35
  "typescript": "^2.9.2"