diff --git a/CHANGELOG.md b/CHANGELOG.md index f114fb3a..5fa2fcb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- zsh auto-complete did not follow the right pattern for people the use auto-completion files + +### Thanks + +Thank you to [@HaleTom](https://github.com/HaleTom) for reporting the zsh problema at +[#295](https://github.com/lucassabreu/clockify-cli/issues/295). + ## [v0.63.0] - 2026-03-26 ### Added diff --git a/pkg/cmd/completion/completion.go b/pkg/cmd/completion/completion.go index 7c89fdc0..70b55fff 100644 --- a/pkg/cmd/completion/completion.go +++ b/pkg/cmd/completion/completion.go @@ -1,8 +1,6 @@ package completion import ( - "fmt" - "io" "strings" "github.com/MakeNowJust/heredoc" @@ -36,7 +34,7 @@ func NewCmdCompletion() *cobra.Command { case bash: return cmd.Root().GenBashCompletion(out) case zsh: - return genZshCompletion(cmd, out) + return cmd.Root().GenZshCompletion(out) case fish: return cmd.Root().GenFishCompletion(out, false) case powershell: @@ -85,17 +83,3 @@ func NewCmdCompletion() *cobra.Command { return cmd } - -func genZshCompletion(cmd *cobra.Command, w io.Writer) error { - if _, err := fmt.Fprintln(w, - "autoload -U compinit; compinit"); err != nil { - return err - } - - if err := cmd.Root().GenZshCompletion(w); err != nil { - return err - } - - _, err := fmt.Fprintln(w, "compdef _clockify-cli clockify-cli") - return err -}