feat: add comprehensive CLI version support (fixes #282)#561
Merged
robinbraemer merged 3 commits intomasterfrom Sep 4, 2025
Merged
feat: add comprehensive CLI version support (fixes #282)#561robinbraemer merged 3 commits intomasterfrom
robinbraemer merged 3 commits intomasterfrom
Conversation
Addresses community request from Discord (issue #282). **New Functionality:** - Add --version and -v flags to display Gate version - Automatically provided by urfave/cli framework - Shows version information set during build process **Flag Changes:** - Change verbosity flag alias from -v to --verbose to avoid conflict - Maintain backward compatibility with --verbosity full flag name - Version flag takes precedence as it's a standard CLI convention **Testing:** - Add comprehensive test suite for version functionality - Verify flag conflicts are resolved - Test version integration and help text display - Validate user agent version inclusion **Usage:** ```bash gate --version # Shows: gate version v1.2.3 gate -v # Same as above ``` Fixes #282
**CLI Version Command:**
- Add --version and -v flags to Gate CLI
- Resolve flag conflict by changing verbosity alias to --verbose
- Maintain backward compatibility with full --verbosity flag
**Version Logging:**
- Log Gate version at CLI startup for operational visibility
- Shows in logs: "starting Gate proxy {version: v0.54.1}"
- Essential for debugging and support
**Build Integration:**
- Update .goreleaser.yml to set version.Version via ldflags
- Add Makefile build target with proper version from git tags
- Update Dockerfile to accept VERSION build arg
- Update CI workflow to pass version to Docker builds
- Export version.Version variable for ldflags access
**Version Detection:**
- Use git describe --tags --always --dirty for accurate versioning
- Fallback to dev-{commit} format when no tags available
- Consistent versioning across all build methods
**Testing:**
- Comprehensive test suite for CLI integration
- Verify flag conflicts resolved
- Test version display and user agent inclusion
Fixes #282
**Proper Unix CLI Conventions:** - -V / --version for version information (not -v) - -v / --verbosity for verbosity level (traditional Unix usage) **Changes:** - Add custom version flag with -V alias following Unix standards - Keep -v for verbosity as per Unix tradition - Use app.HideVersion to avoid urfave/cli automatic flag conflicts - Update tests to verify correct flag behavior and Unix conventions **Flag Behavior:** ```bash gate -V # Show version (Unix convention) gate --version # Show version (long form) gate -v 2 # Set verbosity level (Unix convention) gate --verbosity 2 # Set verbosity level (long form) ``` This resolves flag conflicts and follows established Unix CLI patterns where -v typically means verbose and -V means version.
Deploying gate-minekube with
|
| Latest commit: |
4134a9c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e7e8214c.gate-minekube.pages.dev |
| Branch Preview URL: | https://feat-add-version-command.gate-minekube.pages.dev |
khanghh
pushed a commit
to khanghh/gate
that referenced
this pull request
Feb 24, 2026
…ekube#561) * feat: add CLI version command support Addresses community request from Discord (issue minekube#282). **New Functionality:** - Add --version and -v flags to display Gate version - Automatically provided by urfave/cli framework - Shows version information set during build process **Flag Changes:** - Change verbosity flag alias from -v to --verbose to avoid conflict - Maintain backward compatibility with --verbosity full flag name - Version flag takes precedence as it's a standard CLI convention **Testing:** - Add comprehensive test suite for version functionality - Verify flag conflicts are resolved - Test version integration and help text display - Validate user agent version inclusion **Usage:** ```bash gate --version # Shows: gate version v1.2.3 gate -v # Same as above ``` Fixes minekube#282 * feat: comprehensive version support and build integration **CLI Version Command:** - Add --version and -v flags to Gate CLI - Resolve flag conflict by changing verbosity alias to --verbose - Maintain backward compatibility with full --verbosity flag **Version Logging:** - Log Gate version at CLI startup for operational visibility - Shows in logs: "starting Gate proxy {version: v0.54.1}" - Essential for debugging and support **Build Integration:** - Update .goreleaser.yml to set version.Version via ldflags - Add Makefile build target with proper version from git tags - Update Dockerfile to accept VERSION build arg - Update CI workflow to pass version to Docker builds - Export version.Version variable for ldflags access **Version Detection:** - Use git describe --tags --always --dirty for accurate versioning - Fallback to dev-{commit} format when no tags available - Consistent versioning across all build methods **Testing:** - Comprehensive test suite for CLI integration - Verify flag conflicts resolved - Test version display and user agent inclusion Fixes minekube#282 * fix: use correct Unix conventions for CLI flags **Proper Unix CLI Conventions:** - -V / --version for version information (not -v) - -v / --verbosity for verbosity level (traditional Unix usage) **Changes:** - Add custom version flag with -V alias following Unix standards - Keep -v for verbosity as per Unix tradition - Use app.HideVersion to avoid urfave/cli automatic flag conflicts - Update tests to verify correct flag behavior and Unix conventions **Flag Behavior:** ```bash gate -V # Show version (Unix convention) gate --version # Show version (long form) gate -v 2 # Set verbosity level (Unix convention) gate --verbosity 2 # Set verbosity level (long form) ``` This resolves flag conflicts and follows established Unix CLI patterns where -v typically means verbose and -V means version.
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.
Problem
Gate CLI lacked standard version support, making it difficult for users and operators to verify which version is running. This was requested by the Discord community and is essential for debugging and operational visibility.
Solution
CLI Version Command (Following Unix Conventions)
gate -Vandgate --versioncommands (proper Unix convention)gate -vfor verbosity (traditional Unix usage)--verbosityflagStartup Version Logging
starting Gate proxy {"version": "v0.54.1"}Comprehensive Build Integration
{{.Version}}templatemake buildtarget with proper git version detectionVersion Detection Logic
Uses robust git-based versioning:
Usage Examples
CLI Version Commands (Unix Convention)
Help Output
Startup Logs
Build Integration
Benefits
-Vfor version,-vfor verboseTesting
Closes #282