Skip to content

Commit

Permalink
search CLI handlers in reverse order to allow those installed later t…
Browse files Browse the repository at this point in the history
…o override those already installed
  • Loading branch information
phoddie authored and mkellner committed Feb 13, 2019
1 parent 6ae943b commit c82cd09
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/base/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ const CLI = {

let command = parts.shift().toLowerCase();
if ("help" !== command) {
if (!CLI.handlers.some(handler => handler.call(this, command, parts)))
let found;
for (let i = CLI.handlers.length - 1; !found && (i >= 0); i--)
found = CLI.handlers[i].call(this, command, parts);
if (!found)
this.line(`Unknown command: ${command}`);
}
else
Expand Down

0 comments on commit c82cd09

Please sign in to comment.