Skip to content

Commit

Permalink
fix(command): zsh completion for command aliases not working (#688)
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed Mar 25, 2024
1 parent 53551ac commit 2351c77
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions command/completions/_zsh_completions_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2351c77

Please sign in to comment.