Add zsh completion scripts for bitcoind, bitcoin-cli, and bitcoin-tx using zsh’s native compdef system.
Bash and fish completions already exist, but zsh has no equivalent. Since zsh is the default shell on macOS and widely used on Linux, this fills the gap.
Closes #33404. Continues the work started in #33402.
The scripts are under contrib/completions/zsh/ and match the existing bash completions in functionality:
_bitcoind- option completion with file/directory path handling_bitcoin-cli- RPC command and option completion with context-sensitive arguments (booleans, sighash types, subcommands)_bitcoin-tx- option and command completion with file path handling
All completions dynamically parse -help output rather than hardcoding option lists.
How to test
Copy the scripts to a directory in your zsh fpath and start a new shell:
mkdir -p ~/.zsh/completions
cp contrib/completions/zsh/_bitcoin* ~/.zsh/completions/
# add to .zshrc: fpath=(~/.zsh/completions $fpath) && autoload -Uz compinit && compinit
Then verify tab completion works:
bitcoind -<TAB> # shows options from -help
bitcoind -datadir=<TAB> # completes directories
bitcoin-cli <TAB> # shows options and RPC commands
bitcoin-cli getblock <hash> <TAB> # suggests true/false
bitcoin-tx -create <TAB> # shows transaction commands