Skip to content

Commit

Permalink
fix: command alias resolution bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AxiosLeo committed Feb 1, 2024
1 parent 8a3fbbf commit 461a99a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,19 @@ class App {
async exec(name, argvSlice = 2) {
if (is.invalid(this.commands[name])) {
await load.call(this, true);
Object.values(this.commands).find((c) => {
if (c.config.alias) {
if (is.string(c.config.alias) && name === c.config.alias) {
name = c.config.name;
return true;
}
if (is.array(c.config.alias) && is.contain(c.config.alias, name)) {
name = c.config.name;
return true;
}
}
return false;
});
if (is.invalid(this.commands[name])) {
await this.exec('help');
debug.error(__('${name} command dose not exist.', { name }));
Expand Down

0 comments on commit 461a99a

Please sign in to comment.