Permalink
Browse files

Parseopts should set true for opts with no value passed. Stop tests f…

…or undefinedness of the keys.
  • Loading branch information...
1 parent b783a94 commit 4f25876f3784909df96a9ce4379ff9892f4709d8 @mde committed Nov 5, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/parseopts.js
View
@@ -72,7 +72,7 @@ parseopts.Parser.prototype = new function () {
argName = this.longOpts[argItems[0].substr(2)];
if (argName) {
// If there's no attached value, value is null
- opts[argName] = argItems[1] || null;
+ opts[argName] = argItems[1] || true;
}
else {
throw new Error('Unknown option "' + argItems[0] + '"');
@@ -84,7 +84,7 @@ parseopts.Parser.prototype = new function () {
// If there is no following item, or the next item is
// another opt, value is null
opts[argName] = (!args[0] || (args[0].indexOf('-') == 0)) ?
- null : args.shift();
+ true : args.shift();
}
else {
throw new Error('Unknown option "' + arg + '"');

0 comments on commit 4f25876

Please sign in to comment.