Permalink
Browse files

Fix boolean aliases.

  • Loading branch information...
1 parent f14dda5 commit 4fb60bf17845f4ce3293f8ca49c9a1a7c736cfce @coderarity coderarity committed with Apr 12, 2012
Showing with 4 additions and 3 deletions.
  1. +2 −1 index.js
  2. +2 −2 test/parse.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++;
}
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,

0 comments on commit 4fb60bf

Please sign in to comment.