Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix wrong check for command list #26

Merged
merged 2 commits into from

2 participants

@kosmotaur

command_list never would be falsy

kosmotaur added some commits
@kosmotaur kosmotaur fix wrong check for command list
command_list never would be falsy
494f44e
@kosmotaur kosmotaur change check for option shortkey
now any falsy value can indicate no short key for an option, resulting
in better semantics
99ebc5a
@chriso chriso merged commit c4cddeb into from
@chriso
Owner

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 17, 2011
  1. @kosmotaur

    fix wrong check for command list

    kosmotaur authored
    command_list never would be falsy
  2. @kosmotaur

    change check for option shortkey

    kosmotaur authored
    now any falsy value can indicate no short key for an option, resulting
    in better semantics
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 cli.js
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) {
Something went wrong with that request. Please try again.