Skip to content

Commit

Permalink
Add "extended" to "hugo version"
Browse files Browse the repository at this point in the history
Fixes #4913
  • Loading branch information
anthonyfok authored and bep committed Jul 8, 2018
1 parent 3cea293 commit ce84b52
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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.