Permalink
Browse files

Don't exclude exact shorthands, even if they match a full abbrev

  • Loading branch information...
1 parent 5f0c2ec commit 81d8ded6dfb4f7c877b28d33c914e3b39a2d19ff @isaacs isaacs committed Mar 31, 2011
Showing with 4 additions and 2 deletions.
  1. +3 −1 examples/my-program.js
  2. +1 −1 lib/nopt.js
@@ -17,7 +17,9 @@ var nopt = require("../lib/nopt")
, "b7" : ["--bar", "7"]
, "m" : ["--bloo", "medium"]
, "p" : ["--pick"]
- , "f" : ["--flag"]
+ , "f" : ["--flag", "true"]
+ , "g" : ["--flag"]
+ , "s" : "--flag"
}
// everything is optional.
// knownOpts and shorthands default to {}
View
@@ -226,7 +226,7 @@ function resolveShort (arg, shorthands, shortAbbr, abbrevs) {
// all of the chars are single-char shorthands, and it's
// not a match to some other abbrev.
arg = arg.replace(/^-+/, '')
- if (abbrevs[arg]) {
+ if (abbrevs[arg] && !shorthands[arg]) {
return null
}
if (shortAbbr[arg]) {

0 comments on commit 81d8ded

Please sign in to comment.