Comparing version 0.1.3 to 0.1.4
@@ -0,1 +1,8 @@ | ||
0.1.4 / 2012-07-30 | ||
------------------- | ||
* Fixed pseudo-argument support (thanks to @CGamesPlay) | ||
* Fixed addHelp default (should be true), if not set (thanks to @benblank) | ||
0.1.3 / 2012-06-27 | ||
@@ -2,0 +9,0 @@ ------------------ |
@@ -222,4 +222,4 @@ /** internal | ||
/** | ||
* ActionContainer#addArgumentGroup(options) -> ActionGroup | ||
* - options (Object): hash of options see [[ActionGroup.new]] | ||
* ActionContainer#addArgumentGroup(options) -> ArgumentGroup | ||
* - options (Object): hash of options see [[ArgumentGroup.new]] | ||
* | ||
@@ -226,0 +226,0 @@ * Create new arguments groups |
@@ -25,3 +25,3 @@ /** | ||
* | ||
* Information about action options see [[Action#new]] | ||
* Information about action options see [[Action.new]] | ||
* | ||
@@ -28,0 +28,0 @@ * See also [original guide](http://docs.python.org/dev/library/argparse.html#action) |
@@ -1,2 +0,2 @@ | ||
/*:nodoc:* | ||
/** internal | ||
* class ActionSubparsers | ||
@@ -40,3 +40,3 @@ * | ||
/*:nodoc:* | ||
/** | ||
* new ActionSubparsers(options) | ||
@@ -43,0 +43,0 @@ * - options (object): options hash see [[Action.new]] |
@@ -56,3 +56,3 @@ /** | ||
options.prefixChars = (options.prefixChars || '-'); | ||
options.addHelp = (options.addHelp || false); | ||
options.addHelp = (options.addHelp === undefined || !!options.addHelp); | ||
options.parents = (options.parents || []); | ||
@@ -289,3 +289,3 @@ | ||
} catch (e) { | ||
this.error(e.message); | ||
this.error(e); | ||
} | ||
@@ -317,5 +317,6 @@ }; | ||
argStringPatternParts.push('-'); | ||
argString.forEach(function(forString) { | ||
while (argStringIndex < argStrings.length) { | ||
argStringPatternParts.push('A'); | ||
}); | ||
argStringIndex++; | ||
} | ||
} | ||
@@ -1056,3 +1057,3 @@ // otherwise, add the arg to the arg strings | ||
* ArgumentParser#error(message) -> Void | ||
* - message (string): message | ||
* - err (Error|string): message | ||
* | ||
@@ -1065,6 +1066,13 @@ * Error method Prints a usage message incorporating the message to stderr and | ||
**/ | ||
ArgumentParser.prototype.error = function (message) { | ||
ArgumentParser.prototype.error = function (err) { | ||
if (err instanceof Error) { | ||
if (this.debug === true) { | ||
throw err; | ||
} | ||
err = err.err; | ||
} | ||
var msg = _.str.sprintf( | ||
'%(prog)s: error: %(message)s', | ||
{prog: this.prog, message: message}) + $$.EOL; | ||
'%(prog)s: error: %(err)s', | ||
{prog: this.prog, err: err}) + $$.EOL; | ||
@@ -1071,0 +1079,0 @@ if (this.debug === true) { |
@@ -1,2 +0,2 @@ | ||
/*:nodoc:* | ||
/** internal | ||
* class ArgumentGroup | ||
@@ -20,3 +20,3 @@ * | ||
/*:nodoc:* | ||
/** | ||
* new ArgumentGroup(container, options) | ||
@@ -23,0 +23,0 @@ * - container (object): main container |
{ | ||
"name" : "argparse", | ||
"description" : "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library", | ||
"version" : "0.1.3", | ||
"version" : "0.1.4", | ||
"keywords" : ["cli", "parser", "argparse", "option", "args"], | ||
@@ -6,0 +6,0 @@ "homepage" : "https://github.com/nodeca/argparse", |
@@ -58,4 +58,11 @@ /*global describe, it, before, after, beforeEach, afterEach*/ | ||
}); | ||
it("should support pseudo-argument", function() { | ||
parser.addArgument([ 'bar' ], { nargs: '+' }); | ||
args = parser.parseArgs([ '-f', 'foo', '--', '-f', 'bar' ]); | ||
assert.equal(args.foo, 'foo'); | ||
assert.equal(args.bar.length, 2); | ||
}); | ||
}); | ||
}); | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118437
39
3062