8000 feat: add completions subcommand by va-an · Pull Request #237 · bitcoindevkit/bdk-cli · GitHub
[go: up one dir, main page]

Skip to content

feat: add completions subcommand#237

Merged
tvpeter merged 7 commits intobitcoindevkit:masterfrom
va-an:feat/add-completions-cmd
Mar 20, 2026
Merged

feat: add completions subcommand#237
tvpeter merged 7 commits intobitcoindevkit:masterfrom
va-an:feat/add-completions-cmd

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.

@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
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.

ACK e173b47

@tvpeter tvpeter moved this to Ready to Review in BDK-CLI Feb 23, 2026
@tvpeter tvpeter added this to the CLI 3.0.0 milestone Feb 26, 2026
Copy link
Collaborator
@tvpeter tvpeter left a comment

Choose a reason for hiding this comment

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

ACK eeb3b98

nit: How will the generated completion files stay updated when new versions are released? Can you include that in the README?

@codecov
Copy link
codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 10.84%. Comparing base (6f61d2e) to head (f32fc68).
⚠️ Report is 133 commits behind head on master.

Files with missing lines Patch % Lines
src/handlers.rs 0.00% 6 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (6f61d2e) and HEAD (f32fc68). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (6f61d2e) HEAD (f32fc68)
1 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #237       +/-   ##
===========================================
- Coverage   55.87%   10.84%   -45.04%     
===========================================
  Files           4        8        +4     
  Lines         995     2472     +1477     
===========================================
- Hits          556      268      -288     
- Misses        439     2204     +1765     
Flag Coverage Δ
rust 10.84% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@va-an
Copy link
Contributor Author
va-an commented Mar 19, 2026

ACK eeb3b98

nit: How will the generated completion files stay updated when new versions are released? Can you include that in the README?

Good point!

We use clap_complete's ahead-of-time generation, so completions are static and the user needs to re-run the command after upgrading.

clap_complete also has a runtime completion mode that can self-correct on shell launch, but it's still behind unstable-dynamic feature flag.

Added a note about this to the README:

Completion files are generated from the currently installed binary. After upgrading bdk-cli, re-run the completions command to keep them in sync with the new version.

@va-an va-an force-pushed the feat/add-completions-cmd branch from 0f685a1 to f32fc68 Compare March 19, 2026 09:21
@va-an va-an requested a review from tvpeter March 19, 2026 09:28
Copy link
Member
@notmandatory notmandatory left a comment

Choose a reason for hiding this comment

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

utACK f32fc68

This will be very useful!

@tvpeter tvpeter merged commit 5db2be7 into bitcoindevkit:master Mar 20, 2026
7 of 9 checks passed
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in BDK-CLI Mar 20, 2026
@va-an va-an deleted the feat/add-completions-cmd branch March 20, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add shell completions command

5 participants

0