commands: Do not show empty BuildDate in version

This commit is contained in:
Anthony Fok 2018-04-26 06:35:04 -06:00
parent b2b500f563
commit 4eedb377b6
No known key found for this signature in database
GPG Key ID: EA2500B412C59ACF
1 changed files with 5 additions and 1 deletions

View File

@ -45,7 +45,11 @@ func newVersionCmd() *versionCmd {
func printHugoVersion() {
if hugolib.CommitHash == "" {
jww.FEEDBACK.Printf("Hugo Static Site Generator v%s %s/%s BuildDate: %s\n", helpers.CurrentHugoVersion, runtime.GOOS, runtime.GOARCH, hugolib.BuildDate)
if hugolib.BuildDate == "" {
jww.FEEDBACK.Printf("Hugo Static Site Generator v%s %s/%s\n", helpers.CurrentHugoVersion, runtime.GOOS, runtime.GOARCH)
} else {
jww.FEEDBACK.Printf("Hugo Static Site Generator v%s %s/%s BuildDate: %s\n", helpers.CurrentHugoVersion, runtime.GOOS, runtime.GOARCH, hugolib.BuildDate)
}
} else {
jww.FEEDBACK.Printf("Hugo Static Site Generator v%s-%s %s/%s BuildDate: %s\n", helpers.CurrentHugoVersion, strings.ToUpper(hugolib.CommitHash), runtime.GOOS, runtime.GOARCH, hugolib.BuildDate)
}