Enabling wbsp shell autocomplete (macOS + zsh)

wbsp generates its own completion script (it's a Cobra CLI). It also supports bash, fish, and powershell via wbsp completion <shell>, but these instructions target macOS + zsh.

Try it for the current shell first (instant, no setup)

source <(wbsp completion zsh)

Type wbsp <Tab> — if you get subcommand completions, it works. Now make it permanent.

Make it permanent

The zsh shell uses a Function Search Path variable named fpath to specify locations where function definitions can be found. We use this to store the command completions for wbsp (i.e. as per standard zsh).

1. Write the completion file to a directory on zsh's fpath

mkdir -p ~/.zsh/completions
wbsp completion zsh > ~/.zsh/completions/_wbsp

2. Ensure zsh completion is initialized

(Only once — skip if your ~/.zshrc already has compinit)

cat >> ~/.zshrc << END

# >>> WBSP installer
# Command completion for WBSP (and others)
fpath=(~/.zsh/completions \$fpath)
autoload -Uz compinit
compinit
# <<< WBSP installer
END

3. Restart the shell

exec zsh

Notes / gotchas

  • wbsp must be on your PATH (the installer put it in /usr/local/bin or ~/.local/bin). Check: which wbsp.

  • If completions don't appear after restart, the completion cache is stale — rebuild it:

    rm -f ~/.zcompdump*; compinit
  • Other shells are supported too (wbsp completion bash|fish|powershell) if you use them elsewhere.