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 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 15:08:27 +01:00
parent feb5406077
commit 3c0d4ee471
+11 -4
View File
@@ -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":