feat(cli): add ledger --version - #117
Merged
Merged
Conversation
The CLI had no top-level version flag: `COMMAND` is a required positional argument, so `ledger --version` (or running with no subcommand) just failed with "the following arguments are required: COMMAND". There was no way to ask an installed `ledger` what version it was short of opening pyproject.toml or `pip show`. Add a standard argparse `--version` action that prints `ledger <version>` and exits 0, sourced from `ledger.__version__` — the same installed-package- metadata value every other version-truth path already uses (REL-02), so it cannot drift from pyproject.toml. Verification (offline gates, all green): make lint type test i18n claims hygiene workflow-lint (1021 passed, including the new test). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RwvFhZbxJZZn4bpejFu3Vj
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.
Summary
ledgerhad no top-level version flag.COMMANDis a required positional, soledger --version(or bareledger) just failed with "the following arguments are required: COMMAND" — no way to ask an installedledgerwhat version it was without openingpyproject.tomlorpip show ledger-archive.--versionaction: printsledger <version>and exits 0.ledger.__version__, the same installed-package-metadata value every other version-truth path already uses (RELEASE-AND-VERSIONING-STANDARD REL-02) — so this can't drift frompyproject.toml.Test plan
uv run ledger --versionprintsledger 0.1.0.dev0and exits 0test_version_flag_prints_version_and_exits_zerointests/test_cli.pymake lint type test i18n claims hygiene workflow-lint— all green, 1021 passed (was 1020)ruff format --checkclean🤖 Generated with Claude Code
https://claude.ai/code/session_01RwvFhZbxJZZn4bpejFu3Vj