From 3c0d4ee4717b62c3173f3c85089f6abe309e176e Mon Sep 17 00:00:00 2001 From: Joakim Date: Thu, 19 Feb 2026 15:08:27 +0100 Subject: [PATCH] fix: use proper zsh/bash completion methods and correct zsh install instructions Use GenZshCompletion (native zsh) instead of the old bash-wrapper method. Use GenBashCompletionV2 for modern bash completions. Fix help text to show proper fpath-based zsh installation instead of `source`. Co-Authored-By: Claude Opus 4.6 --- opal-task/cmd/completion.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/opal-task/cmd/completion.go b/opal-task/cmd/completion.go index 7f29d16..e5a6f30 100644 --- a/opal-task/cmd/completion.go +++ b/opal-task/cmd/completion.go @@ -20,9 +20,16 @@ Bash: $ echo 'source <(opal completion bash)' >> ~/.bashrc Zsh: - $ source <(opal completion zsh) - # To load on startup, add to ~/.zshrc: - $ echo 'source <(opal completion zsh)' >> ~/.zshrc + # Option 1: Write to a directory in your $fpath + $ opal completion zsh > "${fpath[1]}/_opal" + # Then restart your shell or run: compinit + + # Option 2: Write to a custom directory and add it to fpath + $ mkdir -p ~/.zsh/completions + $ opal completion zsh > ~/.zsh/completions/_opal + # Add to ~/.zshrc (before compinit): + # fpath=(~/.zsh/completions $fpath) + # autoload -Uz compinit && compinit Fish: $ opal completion fish | source @@ -33,7 +40,7 @@ Fish: Run: func(cmd *cobra.Command, args []string) { switch args[0] { case "bash": - rootCmd.GenBashCompletion(os.Stdout) + rootCmd.GenBashCompletionV2(os.Stdout, true) case "zsh": rootCmd.GenZshCompletion(os.Stdout) case "fish":