From 2351c7774e82d79be32a6cbb5da35b81248cf018 Mon Sep 17 00:00:00 2001 From: Benjamin Fischer Date: Sun, 24 Mar 2024 23:50:51 +0100 Subject: [PATCH] fix(command): zsh completion for command aliases not working (#688) --- command/completions/_zsh_completions_generator.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/command/completions/_zsh_completions_generator.ts b/command/completions/_zsh_completions_generator.ts index 3cddac0f..61ac1f33 100644 --- a/command/completions/_zsh_completions_generator.ts +++ b/command/completions/_zsh_completions_generator.ts @@ -154,11 +154,12 @@ function _${replaceSpecialChars(path)}() {` + if (command.hasCommands(false)) { const actions: string = command .getCommands(false) - .map((command: Command) => - `${command.getName()}) _${ - replaceSpecialChars(path + " " + command.getName()) - } ;;` - ) + .map((command: Command) => { + const aliases = [command.getName(), ...command.getAliases()] + .join("|"); + const action = replaceSpecialChars(path + " " + command.getName()); + return `${aliases}) _${action} ;;`; + }) .join("\n "); return `\n @@ -187,7 +188,6 @@ function _${replaceSpecialChars(path)}() {` + if (command.hasArguments() || command.hasCommands(false)) { argsCommand += ` \\\n '${++argIndex}:command:_commands'`; - const args: string[] = []; // first argument is completed together with commands.