Browse files

fix bug when help message isn't specified for an option

  • Loading branch information...
1 parent 534eaa5 commit 16c14e13502fb360a0716f3e5eeeeecf285b5f95 @harthur committed Feb 11, 2013
Showing with 7 additions and 7 deletions.
  1. +1 −1 nomnom.js
  2. +6 −6 test/usage.js
View
2 nomnom.js
@@ -376,7 +376,7 @@ ArgParser.prototype = {
str += " " + opt.string + spaces(longest - opt.string.length) + " ";
var defaults = (opt.default != null ? " [" + opt.default + "]" : "");
- var help = opt.help + defaults || "";
+ var help = opt.help ? opt.help + defaults : "";
str += this._colors ? help.grey : help;
str += "\n";
View
12 test/usage.js
@@ -1,27 +1,27 @@
var nomnom = require("../nomnom");
function strip(str) {
- return str.replace(/\s+/g, '');
+ return str.replace(/\s+/g, '');
};
var opts = {
apple: {
abbr: 'a',
help: 'how many apples'
},
-
+
banana: {
full: "b-nana"
},
-
+
carrot: {
string: '-c NUM, --carrots=NUM'
},
-
+
dill: {
metavar: 'PICKLE'
},
-
+
egg: {
position: 0,
help: 'robin'
@@ -73,7 +73,7 @@ exports.testUsage = function(test) {
test.equal(string, "test usage")
test.done();
})
- .parse(["--help"]);
+ .parse(["--help"]);
}
exports.testHidden = function(test) {

0 comments on commit 16c14e1

Please sign in to comment.