Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Fok <foka@debian.org>2018-07-08 11:45:13 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-07-08 12:08:54 +0300
commitce84b524f4e94299b5b66afe7ce1a9bd4a9959fc (patch)
tree4c6fe0bb12cf90d1c5a76dc16ae832adbe4537fc /commands
parent3cea2932e17a08ebc19cd05f3079d9379bc8fba5 (diff)
Add "extended" to "hugo version"
Fixes #4913
Diffstat (limited to 'commands')
-rw-r--r--commands/version.go26
1 files changed, 19 insertions, 7 deletions
diff --git a/commands/version.go b/commands/version.go
index dfa79bb69..ea4e4c926 100644
--- a/commands/version.go
+++ b/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)
}