Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix boolean aliases.

  • Loading branch information...
commit 4fb60bf17845f4ce3293f8ca49c9a1a7c736cfce 1 parent f14dda5
Christian Howe coderarity authored committed
Showing with 4 additions and 3 deletions.
  1. +2 −1  index.js
  2. +2 −2 test/parse.js
3  index.js
View
@@ -370,7 +370,8 @@ function Argv (args, cwd) {
var key = arg.slice(-1)[0];
if (args[i+1] && !args[i+1].match(/^-/)
- && !flags.bools[key]) {
+ && !flags.bools[key]
+ && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
setArg(key, args[i+1]);
i++;
}
4 test/parse.js
View
@@ -351,11 +351,11 @@ test('boolean and alias with chainable api', function (t) {
};
var aliasedArgv = optimist(aliased)
.boolean('herp')
- .alias('h')
+ .alias('h', 'herp')
.argv;
var propertyArgv = optimist(regular)
.boolean('herp')
- .alias('h')
+ .alias('h', 'herp')
.argv;
var expected = {
herp: true,
Please sign in to comment.
Something went wrong with that request. Please try again.