Skip to content

Conversation

@va-an
Copy link
Contributor

@va-an va-an commented Feb 7, 2026

Description

Resolves #234.

Added completions subcommand to generate shell completions.

How to test

Install bdk-cli:

cargo install --path . --all-features

See how to install completions for your shell:

bdk-cli completions --help

For example, to install completions for zsh:

bdk-cli completions zsh > ~/.zfunc/_bdk-cli

After restarting the shell, completions should work with Tab.

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature
  • I've updated CHANGELOG.md

@coveralls
Copy link

coveralls commented Feb 7, 2026

Pull Request Test Coverage Report for Build 21858546890

Details

  • 0 of 16 (0.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 10.686%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/utils.rs 0 1 0.0%
src/error.rs 0 3 0.0%
src/handlers.rs 0 6 0.0%
src/payjoin/mod.rs 0 6 0.0%
Totals Coverage Status
Change from base Build 21153868360: -0.03%
Covered Lines: 268
Relevant Lines: 2508

💛 - Coveralls

Copy link
Contributor

@AmosOO7 AmosOO7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @va-an , nice work on this. I tested and it worked fine on my end.

I left a comment on some part in the command.rs file that I think should be moved to the README.md file.

Also I had to create the folders bash-completion, and completions in ~/.local/share I don't know if this is peculiar to my case, but maybe it is something you can add in the readme file also to mkdir this folders so the command bdk-cli completions bash > ~/.local/share/bash-completion/completions/bdk-cli runs smoothly and for any other commands that might need it.

src/commands.rs Outdated
Comment on lines 136 to 152
/// Bash:
/// bdk-cli completions bash > ~/.local/share/bash-completion/completions/bdk-cli
///
/// Zsh:
/// bdk-cli completions zsh > ~/.zfunc/_bdk-cli
/// # Make sure ~/.zfunc is in your fpath (add to .zshrc):
/// # fpath=(~/.zfunc $fpath)
/// # autoload -Uz compinit && compinit
///
/// Fish:
/// bdk-cli completions fish > ~/.config/fish/completions/bdk-cli.fish
///
/// PowerShell:
/// bdk-cli completions powershell >> $PROFILE
///
/// Elvish:
/// bdk-cli completions elvish >> ~/.elvish/rc.elv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this part should be moved to the README.md file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for displaying the bdk-cli completions --help command. I made this by analogy with rustup completions --help.

I suggest keeping the detailed instructions for setting up completions in bdk-cli completions --help, since this relates only to a specific command, not to the entire program as a whole.

But I think it would be useful to mention the new completions command in the README, as this will significantly simplify users' interaction with bdk-cli.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added new block about completions to README.

@va-an
Copy link
Contributor Author

va-an commented Feb 10, 2026

Also I had to create the folders bash-completion, and completions in ~/.local/share I don't know if this is peculiar to my case, but maybe it is something you can add in the readme file also to mkdir this folders so the command bdk-cli completions bash > ~/.local/share/bash-completion/completions/bdk-cli runs smoothly and for any other commands that might need it.

Thank you for catching this!
I updated the help for completions, made the formatting cleaner, and added information about creating the directory.

@va-an va-an requested a review from AmosOO7 February 10, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add shell completions command

3 participants