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 f94c363 commit c13cee15104a4904d053fc784ab850f243bb7a76 @mde mde committed Nov 5, 2010
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/jake.js
View
@@ -105,7 +105,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] + '"');
@@ -117,7 +117,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 + '"');
@@ -418,11 +418,11 @@ if (jakefile[0] != '/') {
jakefile = path.join(dirname, jakefile);
}
-if (typeof opts.help != 'undefined') {
+if (opts.help) {
jake.die(usage);
}
-if (typeof opts.version != 'undefined') {
+if (opts.version) {
jake.die(JAKE_VERSION);
}
@@ -452,7 +452,7 @@ catch (e) {
jake.die('Could not load Jakefile: ' + e);
}
-if (typeof opts.tasks != 'undefined') {
+if (opts.tasks) {
jake.showAllTaskDescriptions();
}
else {

0 comments on commit c13cee1

Please sign in to comment.