fix wrong check for command list #26

Merged
merged 2 commits into from Sep 19, 2011
Jump to file or symbol
Failed to load files and symbols.
+2 −2
Split
View
4 cli.js
@@ -270,7 +270,7 @@ cli.parse = function (opts, command_def) {
if (!(opt_list[opt] instanceof Array)) {
continue;
}
- if (opt_list[opt][0] === false) {
+ if (!opt_list[opt][0]) {
opt_list[opt][0] = opt;
}
if (o === opt || o === opt_list[opt][0]) {
@@ -586,7 +586,7 @@ cli.getUsage = function () {
return truncated;
};
- usage = usage || cli.app + ' [OPTIONS]' + (command_list ? ' <command>' : '') + ' [ARGS]';
+ usage = usage || cli.app + ' [OPTIONS]' + (command_list.length ? ' <command>' : '') + ' [ARGS]';
console.error('\x1b[1mUsage\x1b[0m:\n ' + usage);
console.error('\n\x1b[1mOptions\x1b[0m: ');
for (opt in opt_list) {