Permalink
Browse files

Add "extended" to "hugo version"

Fixes #4913
  • Loading branch information...
anthonyfok authored and bep committed Jul 8, 2018
1 parent 3cea293 commit ce84b524f4e94299b5b66afe7ce1a9bd4a9959fc
Showing with 19 additions and 7 deletions.
  1. +19 −7 commands/version.go
@@ -19,6 +19,7 @@ import (
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/resource/tocss/scss"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
)
@@ -44,13 +45,24 @@ func newVersionCmd() *versionCmd {
}
func printHugoVersion() {
if hugolib.CommitHash == "" {
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)
}
program := "Hugo Static Site Generator"
version := "v" + helpers.CurrentHugoVersion.String()
if hugolib.CommitHash != "" {
version += "-" + strings.ToUpper(hugolib.CommitHash)
}
if scss.Supports() {
version += "/extended"
}
osArch := runtime.GOOS + "/" + runtime.GOARCH
var buildDate string
if hugolib.BuildDate != "" {
buildDate = 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)
buildDate = "unknown"
}
jww.FEEDBACK.Println(program, version, osArch, "BuildDate:", buildDate)
}

0 comments on commit ce84b52

Please sign in to comment.