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 (
"fmt"
"runtime"
"strings"
)
@ -18,16 +19,19 @@ func NewCmdVersion() Command {
func VersionCmd(args CmdArgs) (int, error) {
var b strings.Builder
fmt.Fprintf(&b, "lume %s", Version)
b.WriteString(" ")
fmt.Fprintf(&b, "lume, version %s\n", Version)
if GitCommit != "" {
fmt.Fprintf(&b, "(git: %s)", GitCommit)
b.WriteString(" ")
fmt.Fprintf(&b, " revision: %s\n", GitCommit)
}
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
}