version: more small tweaks

This commit is contained in:
David Allen 2024-10-16 13:32:16 -06:00
parent 3aaa7c4f1d
commit 26522ebd12
Signed by: towk
GPG key ID: 793B2924A49B3A3F
2 changed files with 11 additions and 10 deletions

View file

@ -14,16 +14,17 @@ var (
)
var versionCmd = &cobra.Command{
Use: "version",
Use: "version",
Short: "Print version info and exit",
Run: func(cmd *cobra.Command, args []string) {
if cmd.Flag("commit").Value.String() == "true" {
output = commit
if date != "" {
output += " built @ " + date
output += " built on " + date
}
fmt.Println(output)
} else {
fmt.Println(version)
fmt.Printf("%s-%s\n", version, commit)
}
},
}