Skip to content
Myr

fix: Don't complete _command on zsh (#1690)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Previously the generated zsh completion script started with the line #compdef _<command> <command> where <command> is the command that the zsh completion script is generated for. This enabled completions for both <command> and _<command>, but _<command> is the completion function itself and should not be completed. Furthermore, attempting to autocomplete _<command> (e.g. typing "_<command><Space><Tab>" in a zsh shell) causes zsh to hang. This commit fixes the #compdef line to only complete <command>, not _<command>.

authored by Tom Payne · committed by GitHub · parent 5b11656 · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Arvid Norlander <VorpalBlade@users.noreply.github.com>

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:zsh_completions.go+1 added-1 removed
73 unmodified lines
74 compCmd := ShellCompRequestCmd75 if !includeDesc {76 compCmd = ShellCompNoDescRequestCmd77 }78 WriteStringAndCheck(buf, fmt.Sprintf(`#compdef _%[1]s %[1]s78 WriteStringAndCheck(buf, fmt.Sprintf(`#compdef %[1]s7980# zsh completion for %-36[1]s -*- shell-script -*-8182__%[1]s_debug()
176 unmodified lines