Change version format

This commit is contained in:
Ryan Cavicchioni 2021-03-15 23:18:19 -05:00
parent dfa5d41a6d
commit d5db68dbfa
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -2,6 +2,7 @@ package lumecmd
import ( import (
"fmt" "fmt"
"runtime"
"strings" "strings"
) )
@ -18,16 +19,19 @@ func NewCmdVersion() Command {
func VersionCmd(args CmdArgs) (int, error) { func VersionCmd(args CmdArgs) (int, error) {
var b strings.Builder var b strings.Builder
fmt.Fprintf(&b, "lume %s", Version) fmt.Fprintf(&b, "lume, version %s\n", Version)
b.WriteString(" ")
if GitCommit != "" { if GitCommit != "" {
fmt.Fprintf(&b, "(git: %s)", GitCommit) fmt.Fprintf(&b, " revision: %s\n", GitCommit)
b.WriteString(" ")
} }
if BuildDate != "" { if BuildDate != "" {
fmt.Fprintf(&b, "build_date: %s", BuildDate) fmt.Fprintf(&b, " build date: %s\n", BuildDate)
} }
fmt.Println(b.String()) fmt.Fprintf(&b, " go version: %s\n", runtime.Version())
fmt.Fprintf(&b, " platform: %s\n", runtime.GOOS+"/"+runtime.GOARCH)
fmt.Print(b.String())
return ExitSuccess, nil return ExitSuccess, nil
} }