Please describe the feature you’d like to see added.
Bitcoin Core currently provides bash completion scripts for bitcoin-cli
, bitcoin-tx
, and bitcoind
in contrib/completions/bash/
, and similarly, fish completion scripts are available in contrib/completions/fish/
, but there are no equivalent completion scripts for zsh users. Many developers and users have adopted zsh as their default shell (especially Mac OSX users and with tools like Oh My Zsh), and they cannot benefit from tab completion when using Bitcoin Core command-line tools.
The potential benefits of adding zsh completions are:
- Consistent user experience across different shells
- Reduced typing errors and improved productivity
- Better discoverability of Bitcoin Core command options
- No impact on existing bash completion functionality
Is your feature related to a problem, if so please describe it.
The existing bash completion scripts are not compatible with zsh due to differences in:
- Completion function syntax and structure
- Array handling and word splitting
- Built-in completion functions (
compgen
vs_describe
,_files
, etc.)
Describe the solution you’d like
Add zsh completion scripts that provide the same functionality as the existing bash completions, but using zsh’s native compdef
system. These would include:
_bitcoin-cli
: Complete RPC commands, options, and context-sensitive arguments (e.g., boolean values for specific commands, file paths for wallet operations)_bitcoin-tx
: Complete transaction creation options and commands with proper argument handling_bitcoind
: Complete daemon configuration options with file/directory path completion
I have already converted the existing bash completion scripts to zsh format and can provide a pull request with the implementation. The scripts maintain feature parity with the bash versions while using zsh-native completion functions for better integration and performance.
The scripts would be located in contrib/completions/zsh/
following the same organizational structure as the bash completions.
Describe any alternatives you’ve considered
- Using bash completion in zsh: While zsh can source bash completions with
bashcompinit
, this provides suboptimal performance and doesn’t integrate well with zsh’s completion system. Not all Bash completion scripts will work perfectly in Zsh; advanced Bash-specific functions may fail. - Manual completion: Users currently have to type commands and options manually without any completion assistance
- Third-party solutions: No comprehensive third-party zsh completions exist for Bitcoin Core tools
Please leave any additional context
- zsh is the default shell on macOS since Catalina (10.15) and is increasingly popular among developers
- The implementation would convert existing bash completion logic to zsh equivalents while maintaining all current functionality
- This would improve developer experience and reduce command-line errors for zsh users
- Similar completion script for zsh have been made to other major open-source projects