commander
Advanced tools
Comparing version 1.1.0 to 1.1.1
1.1.1 / 2012-11-20 | ||
================== | ||
* add more sub-command padding | ||
* fix .usage() when args are present. Closes #106 | ||
1.1.0 / 2012-11-16 | ||
@@ -3,0 +9,0 @@ ================== |
21
index.js
@@ -94,3 +94,3 @@ /*! | ||
this.options = []; | ||
this.args = []; | ||
this._args = []; | ||
this._name = name; | ||
@@ -193,6 +193,6 @@ } | ||
case '<': | ||
self.args.push({ required: true, name: arg.slice(1, -1) }); | ||
self._args.push({ required: true, name: arg.slice(1, -1) }); | ||
break; | ||
case '[': | ||
self.args.push({ required: false, name: arg.slice(1, -1) }); | ||
self._args.push({ required: false, name: arg.slice(1, -1) }); | ||
break; | ||
@@ -241,3 +241,3 @@ } | ||
self.args.forEach(function(arg, i){ | ||
self._args.forEach(function(arg, i){ | ||
if (arg.required && null == args[i]) { | ||
@@ -251,4 +251,4 @@ self.missingArgument(arg.name); | ||
// expects | ||
if (self.args.length) { | ||
args[self.args.length] = self; | ||
if (self._args.length) { | ||
args[self._args.length] = self; | ||
} else { | ||
@@ -683,3 +683,3 @@ args.push(self); | ||
Command.prototype.usage = function(str){ | ||
var args = this.args.map(function(arg){ | ||
var args = this._args.map(function(arg){ | ||
return arg.required | ||
@@ -693,3 +693,4 @@ ? '<' + arg.name + '>' | ||
+ ']' | ||
+ (this.args.length ? ' ' + args : ''); | ||
+ (this._args.length ? ' ' + args : ''); | ||
if (0 == arguments.length) return this._usage || usage; | ||
@@ -747,3 +748,3 @@ this._usage = str; | ||
, this.commands.map(function(cmd){ | ||
var args = cmd.args.map(function(arg){ | ||
var args = cmd._args.map(function(arg){ | ||
return arg.required | ||
@@ -757,3 +758,3 @@ ? '<' + arg.name + '>' | ||
? ' [options]' | ||
: '') + ' ' + args, 18) | ||
: '') + ' ' + args, 22) | ||
+ (cmd.description() | ||
@@ -760,0 +761,0 @@ ? ' ' + cmd.description() |
{ | ||
"name": "commander" | ||
, "version": "1.1.0" | ||
, "version": "1.1.1" | ||
, "description": "the complete solution for node.js command-line programs" | ||
@@ -5,0 +5,0 @@ , "keywords": ["command", "option", "parser", "prompt", "stdin"] |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
35304
1