main.go: open test window on bare 'drover' (no subcommand)
Without this, double-clicking drover.exe printed CLI help to stdout — fine in a terminal but invisible to a user who just clicked an icon. Adding a RunE on the root command opens the smoke-test message box when no subcommand was given. CLI flags (--version, --help) and explicit subcommands keep their old behaviour. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,13 @@ func newRootCmd() *cobra.Command {
|
|||||||
Version: fmt.Sprintf("%s (commit %s, built %s)", Version, Commit, BuildDate),
|
Version: fmt.Sprintf("%s (commit %s, built %s)", Version, Commit, BuildDate),
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
SilenceErrors: false,
|
SilenceErrors: false,
|
||||||
|
// No subcommand and no flags = end-user double-clicked the exe;
|
||||||
|
// open the smoke-test window instead of dumping CLI help to a
|
||||||
|
// console they didn't ask for.
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
showTestWindow()
|
||||||
|
return nil
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom version template: "drover-go vX.Y.Z (commit abc1234, built 2026-05-01)".
|
// Custom version template: "drover-go vX.Y.Z (commit abc1234, built 2026-05-01)".
|
||||||
|
|||||||
Reference in New Issue
Block a user