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.
15 lines
178 B
Go
15 lines
178 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
printVersionHeader(os.Args[1:])
|
|
if err := rootCmd.Execute(); err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(1)
|
|
}
|
|
}
|