Skip to content

Add --version/-v flag with build-time version injection#18

Merged
jravani merged 5 commits intomainfrom
17-add-version-flag
Feb 9, 2026
Merged

Add --version/-v flag with build-time version injection#18
jravani merged 5 commits intomainfrom
17-add-version-flag

Conversation

@jravani
Copy link
Contributor

@jravani jravani commented Feb 9, 2026

Summary

This PR adds a dedicated version flag to the City2TABULA CLI so users can easily report the exact software version when opening issues.

Changes

  • Adds --version and -v flags that print the current version string to stdout and exit with code 0
  • Ensures the version flag exits immediately (no config loading, no DB calls, no side effects)
  • Introduces internal/version with build-time injected values via -ldflags (tag/commit/date), while keeping CLI output to only the version string

How to test

./city2tabula --version
./city2tabula -v

Expected output

v0.0.0-test2 (commit <commit-hash>, built YYYY-MM-DDTHH:MM:SSZ)

Closes #17

- Create release.yml for automated builds and asset uploads on version tag pushes.
- Implement versioning in main.go to display version information.
- Introduce version.go to manage version details (version, commit, date).
@jravani jravani linked an issue Feb 9, 2026 that may be closed by this pull request
5 tasks
@jravani jravani merged commit 6641052 into main Feb 9, 2026
2 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.

Add CLI flag to print City2TABULA version (--version / -v)

1 participant