feat(cli): add --version flag and show version in help - #38
Merged
Conversation
Register a top-level --version option on the CLI group and render "AFQuery v<version>" in the group help header. The version is read from afquery.__version__ (populated by hatch-vcs from the release tag), so it needs no manual update per release. Drop the hand-maintained "Commands: ..." line from the group docstring; Click already generates a complete Commands section.
Add a "Global options" section to the CLI reference covering --version and --help.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #38 +/- ##
==========================================
+ Coverage 88.67% 88.69% +0.01%
==========================================
Files 22 22
Lines 3073 3077 +4
Branches 482 482
==========================================
+ Hits 2725 2729 +4
Misses 229 229
Partials 119 119 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
Notes / known limitations:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
--versionoption on the CLI group:afquery --versionnow printsafquery <version>instead of failing withError: No such option '--version'.AFQuery v<version>in the group help header (afquery --helpandafquerywith no arguments).Commands: ...line from the group docstring; Click already renders a completeCommands:section.--version/--helpoptions in the CLI reference.Why
The installable client had no way to report its own version. The number is read from
afquery.__version__, whichhatch-vcspopulates from the release tag at build time, so this needs no manual bump on future releases.Tests
Added
tests/test_cli.pycoverage for--version, the help header, and the command listing. Full suite green locally (603 passed).