✨ Replace version subcommand with --version flag - #211
Merged
Merged
Conversation
- Set root.Version and a bare-string SetVersionTemplate so --version prints just the version number, matching the old version subcommand's output; --version now bypasses --log-level validation and the config precheck since cobra resolves it before PersistentPreRunE runs - Update unit and e2e tests accordingly; the legacy-migration e2e case switches from version to man to keep exercising the boot-time config precheck for a command that never builds the app - Document --version in the man page's GLOBAL OPTIONS and remove the factorix version COMMANDS entry Closes #210
sakuro
deleted the
feature/replace-version-subcommand-with-version-flag
branch
September 5, 2026 21:11
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.
Summary
Replace the
versionsubcommand with a--versionglobal flag on the root command, using cobra's built-in version flag mechanism.Changes
internal/cli/cli.go: setroot.Versionand a bare-string version template so--versionprints just the version number (e.g.0.23.0); removenewVersionCommand()--versionis resolved by cobra beforePersistentPreRunE, so it now bypasses--log-levelvalidation and the config precheck, unlike the old subcommandinternal/cli/cli_test.goaccordingly;TestInvalidLogLevelRejectedAtParseTimenow targetsmaninstead ofversionsince it needs a command that still goes through the precheck without building the appversionandconfig/legacy-migratione2e cases to match (the latter switches tomanto keep testing that a legacyconfig.rbfails boot-time precheck even for an app-less command)doc/factorix.1: document--versionunderGLOBAL OPTIONS, remove thefactorix versionentryTest Plan
mise run default(test + e2e + vet + lint + fmt-check) passesfactorix --versionprints the version andfactorix versionnow errors with "unknown command"Closes #210