Skip to content

Add version display to normal CLI execution (all contexts) #29

@coderabbitai

Description

@coderabbitai

Problem

Version information is not displayed during normal CLI execution (when processing files). Users expect to see the version string at the start of every execution.

Current behavior

✅ Version shown correctly for: -V, --version, --help (via clap)
❌ Version NOT shown when: executing with file parameters (e.g., bbl_parser myfile.bbl)

Expected behavior

Version should be printed at the start of ALL executions, including normal file processing:

bbl_parser 0.9.0 14be1ee (2025-12-04)
Processing: myfile.bbl
...

Context

The VERSION_STR format was temporarily broken in commits d82343a/1711b6f (missing CARGO_PKG_VERSION), but was fixed in 65b64cc and now has the correct format.

AI-instructional implementation plan

1. Add version printing to main execution flow

In src/main.rs::main(), add println!("{} {}", env!("CARGO_PKG_NAME"), VERSION_STR); immediately after get_matches().

Note: Clap automatically exits after handling --version/--help, so the println only executes during normal file processing.

2. Verification test cases

Test all contexts: -V, --version, --help, no parameters, and normal execution with files.

3. Acceptance criteria

  • Version printed at start of normal execution (processing files)
  • Version still shown correctly for -V, --version, --help (via clap, unchanged)
  • Format matches: bbl_parser 0.9.0 14be1ee (2025-12-04)
  • No duplicate version printing
  • All existing tests pass

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions