Skip to content

fix(cli): report real crate version in --version#64

Merged
Kingvic300 merged 1 commit into
mainfrom
fix/42-cli-version
Jun 7, 2026
Merged

fix(cli): report real crate version in --version#64
Kingvic300 merged 1 commit into
mainfrom
fix/42-cli-version

Conversation

@Kingvic300

@Kingvic300 Kingvic300 commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

txio --version printed txio 1.0 because the clap version was hardcoded, disagreeing with the actual crate version (0.1.2 in Cargo.toml) and the published crate.

Changes

  • Use env!("CARGO_PKG_VERSION") for the clap command version in parser.rs so it always matches the build.

Testing

  • cargo check -p txio passes.

Closes #42

Summary by CodeRabbit

  • Chores
    • CLI version now accurately reflects the current package version instead of displaying a hardcoded value.

clap had the version hardcoded to "1.0", so `txio --version` disagreed
with Cargo.toml (0.1.2) and the published crate. Use CARGO_PKG_VERSION so
it always tracks the build.

Closes #42
@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
txio Ready Ready Preview, Comment Jun 7, 2026 11:37am

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4d9541ae-9a0b-4166-890c-dc02b172a9bb

📥 Commits

Reviewing files that changed from the base of the PR and between 74b9e4b and 31b227d.

📒 Files selected for processing (1)
  • cli/src/cli/parser.rs

📝 Walkthrough

Walkthrough

This PR resolves the CLI version mismatch by updating the clap command metadata to use the Cargo package version macro. The hardcoded version string "1.0" is replaced with env!("CARGO_PKG_VERSION"), ensuring txio --version always reports the version from Cargo.toml.

Changes

CLI Version Configuration

Layer / File(s) Summary
Dynamic version from Cargo metadata
cli/src/cli/parser.rs
The Cli command's version attribute is changed from the hardcoded string "1.0" to env!("CARGO_PKG_VERSION"), which resolves to the crate version at compile time.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A hardcoded one became the past,
Now Cargo's version holds steadfast,
The CLI whispers truth at last—
--version now aligns so fast! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: updating the CLI version flag to report the real crate version instead of a hardcoded string.
Linked Issues check ✅ Passed The code change directly addresses issue #42 by replacing the hardcoded version string with env!("CARGO_PKG_VERSION"), ensuring --version reflects the actual build version.
Out of Scope Changes check ✅ Passed The change is tightly scoped to the single requirement from issue #42 with no extraneous modifications to unrelated code.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/42-cli-version

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kingvic300 Kingvic300 merged commit c14e497 into main Jun 7, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Low] txio --version reports wrong version (1.0 vs 0.1.2)

1 participant