Shorten commit SHA in version output

This commit is contained in:
Christian Muehlhaeuser 2019-12-09 14:01:47 +01:00
parent 2bae07eac9
commit ee81103ce0

View file

@ -137,9 +137,9 @@ func main() {
}
func init() {
if CommitSHA != "" {
if len(CommitSHA) >= 7 {
vt := rootCmd.VersionTemplate()
rootCmd.SetVersionTemplate(vt[:len(vt)-1] + " (" + CommitSHA + ")\n")
rootCmd.SetVersionTemplate(vt[:len(vt)-1] + " (" + CommitSHA[0:7] + ")\n")
}
if Version == "" {
Version = "unknown (built from source)"