commander 2.19.0 → 2.20.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,16 @@
1
1
 
2
+ 2.20.0 / 2019-04-02
3
+ ==================
4
+
5
+ * fix: resolve symbolic links completely when hunting for subcommands (#935)
6
+ * Update index.d.ts (#930)
7
+ * Update Readme.md (#924)
8
+ * Remove --save option as it isn't required anymore (#918)
9
+ * Add link to the license file (#900)
10
+ * Added example of receiving args from options (#858)
11
+ * Added missing semicolon (#882)
12
+ * Add extension to .eslintrc (#876)
13
+
2
14
  2.19.0 / 2018-10-02
3
15
  ==================
4
16
 
package/Readme.md CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  ## Installation
15
15
 
16
- $ npm install commander --save
16
+ $ npm install commander
17
17
 
18
18
  ## Option parsing
19
19
 
@@ -65,6 +65,17 @@ if (program.sauce) console.log(' with sauce');
65
65
  else console.log(' without sauce');
66
66
  ```
67
67
 
68
+ To get string arguments from options you will need to use angle brackets <> for required inputs or square brackets [] for optional inputs.
69
+
70
+ e.g. ```.option('-m --myarg [myVar]', 'my super cool description')```
71
+
72
+ Then to access the input if it was passed in.
73
+
74
+ e.g. ```var myInput = program.myarg```
75
+
76
+ **NOTE**: If you pass a argument without using brackets the example above will return true and not the value passed in.
77
+
78
+
68
79
  ## Version option
69
80
 
70
81
  Calling the `version` implicitly adds the `-V` and `--version` options to the command.
@@ -414,4 +425,4 @@ More Demos can be found in the [examples](https://github.com/tj/commander.js/tre
414
425
 
415
426
  ## License
416
427
 
417
- MIT
428
+ [MIT](https://github.com/tj/commander.js/blob/master/LICENSE)
package/index.js CHANGED
@@ -527,14 +527,11 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
527
527
 
528
528
  // In case of globally installed, get the base dir where executable
529
529
  // subcommand file should be located at
530
- var baseDir,
531
- link = fs.lstatSync(f).isSymbolicLink() ? fs.readlinkSync(f) : f;
530
+ var baseDir;
532
531
 
533
- // when symbolink is relative path
534
- if (link !== f && link.charAt(0) !== '/') {
535
- link = path.join(dirname(f), link);
536
- }
537
- baseDir = dirname(link);
532
+ var resolvedLink = fs.realpathSync(f);
533
+
534
+ baseDir = dirname(resolvedLink);
538
535
 
539
536
  // prefer local `./<bin>` to bin in the $PATH
540
537
  var localBin = path.join(baseDir, bin);
@@ -664,7 +661,7 @@ Command.prototype.parseArgs = function(args, unknown) {
664
661
  this.unknownOption(unknown[0]);
665
662
  }
666
663
  if (this.commands.length === 0 &&
667
- this._args.filter(function(a) { return a.required }).length === 0) {
664
+ this._args.filter(function(a) { return a.required; }).length === 0) {
668
665
  this.emit('command:*');
669
666
  }
670
667
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commander",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "description": "the complete solution for node.js command-line programs",
5
5
  "keywords": [
6
6
  "commander",
@@ -226,9 +226,10 @@ declare namespace local {
226
226
  * Set the description to `str`.
227
227
  *
228
228
  * @param {string} str
229
+ * @param {{[argName: string]: string}} argsDescription
229
230
  * @return {(Command | string)}
230
231
  */
231
- description(str: string): Command;
232
+ description(str: string, argsDescription?: {[argName: string]: string}): Command;
232
233
  description(): string;
233
234
 
234
235
  /**