Skip to content

feat: add --version/-V flag#1

Merged
garyblankenship merged 1 commit intomainfrom
feat/version-flag
Dec 29, 2025
Merged

feat: add --version/-V flag#1
garyblankenship merged 1 commit intomainfrom
feat/version-flag

Conversation

@quicktoolbox
Copy link
Copy Markdown

Summary

Add version flag to cclint CLI following Go/Cobra conventions.

Changes

  • Added Version variable (defaults to "dev", overridable via ldflags)
  • Set rootCmd.Version to enable Cobra's automatic version handling
  • Used -V short flag (since -v is already used for verbose)

Usage

cclint --version    # cclint version dev
cclint -V           # cclint version dev

Build with custom version

go build -ldflags "-X github.com/dotcommander/cclint/cmd.Version=1.0.0" -o cclint .

Testing

Verified both --version and -V flags work correctly.

Add version flag to cclint CLI following Cobra conventions.

- Add Version variable (defaults to "dev", overridable via ldflags)
- Set rootCmd.Version to enable automatic version handling
- Use -V short flag (since -v is used for verbose)

Usage:
  cclint --version
  cclint -V

Build with custom version:
  go build -ldflags "-X github.com/dotcommander/cclint/cmd.Version=1.0.0"
@garyblankenship garyblankenship merged commit b14cae9 into main Dec 29, 2025
2 checks passed
@garyblankenship garyblankenship deleted the feat/version-flag branch December 29, 2025 23:27
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.

2 participants