feat(cli): always print version header first, add --no-version flag
Previously the version banner only printed via PersistentPreRun, which Cobra skips for --help and bare invocations. It now prints from main() before Cobra parses anything, so it's the first line for every command. Suppressible with --no-version; skipped for the version subcommand to avoid duplicating its own output.
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
printVersionHeader(os.Args[1:])
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user