Skip to content

✨ Replace version subcommand with --version flag - #211

Merged
sakuro merged 1 commit into
mainfrom
feature/replace-version-subcommand-with-version-flag
Sep 5, 2026
Merged

sakuro merged 1 commit into
mainfrom
feature/replace-version-subcommand-with-version-flag

Conversation

@sakuro

@sakuro sakuro commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

Replace the version subcommand with a --version global flag on the root command, using cobra's built-in version flag mechanism.

Changes

  • internal/cli/cli.go: set root.Version and a bare-string version template so --version prints just the version number (e.g. 0.23.0); remove newVersionCommand()
  • --version is resolved by cobra before PersistentPreRunE, so it now bypasses --log-level validation and the config precheck, unlike the old subcommand
  • Update internal/cli/cli_test.go accordingly; TestInvalidLogLevelRejectedAtParseTime now targets man instead of version since it needs a command that still goes through the precheck without building the app
  • Update the version and config/legacy-migration e2e cases to match (the latter switches to man to keep testing that a legacy config.rb fails boot-time precheck even for an app-less command)
  • Update doc/factorix.1: document --version under GLOBAL OPTIONS, remove the factorix version entry

Test Plan

  • mise run default (test + e2e + vet + lint + fmt-check) passes
  • Manually verified factorix --version prints the version and factorix version now errors with "unknown command"

Closes #210

- 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
sakuro merged commit 8c1c627 into main Sep 5, 2026
2 checks passed
@sakuro
sakuro deleted the feature/replace-version-subcommand-with-version-flag branch September 5, 2026 21:11
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.

✨ Replace version subcommand with --version flag

1 participant