@@ -18,6 +18,7 @@ use bdk_wallet::bitcoin::{
1818 bip32:: { DerivationPath , Xpriv } ,
1919} ;
2020use clap:: { Args , Parser , Subcommand , ValueEnum , value_parser} ;
21+ use clap_complete:: Shell ;
2122
2223#[ cfg( any( feature = "electrum" , feature = "esplora" , feature = "rpc" ) ) ]
2324use crate :: utils:: parse_proxy_auth;
@@ -127,7 +128,39 @@ pub enum CliSubCommand {
127128 } ,
128129 /// List all saved wallet configurations.
129130 Wallets ,
131+ /// Generate tab-completion scripts for your shell.
132+ ///
133+ /// Outputs a shell-specific completion script to stdout.
134+ /// To enable completions you need to redirect this output into the appropriate location for your shell.
135+ ///
136+ /// Bash:
137+ /// bdk-cli completions bash > ~/.local/share/bash-completion/completions/bdk-cli
138+ ///
139+ /// Zsh:
140+ /// bdk-cli completions zsh > ~/.zfunc/_bdk-cli
141+ /// # Make sure ~/.zfunc is in your fpath (add to .zshrc):
142+ /// # fpath=(~/.zfunc $fpath)
143+ /// # autoload -Uz compinit && compinit
144+ ///
145+ /// Fish:
146+ /// bdk-cli completions fish > ~/.config/fish/completions/bdk-cli.fish
147+ ///
148+ /// PowerShell:
149+ /// bdk-cli completions powershell >> $PROFILE
150+ ///
151+ /// Elvish:
152+ /// bdk-cli completions elvish >> ~/.elvish/rc.elv
153+ ///
154+ /// After installing the completion script, restart your shell or source
155+ /// the configuration file for the changes to take effect.
156+ #[ command( verbatim_doc_comment) ]
157+ Completions {
158+ /// Target shell syntax
159+ #[ arg( value_enum) ]
160+ shell : Shell ,
161+ } ,
130162}
163+
131164/// Wallet operation subcommands.
132165#[ derive( Debug , Subcommand , Clone , PartialEq ) ]
133166pub enum WalletSubCommand {
0 commit comments