diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-11-26 10:11:22 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-12-06 14:37:25 +0100 |
commit | 831d23cb4d1ca99cdc15ed31c8ee1f981497be8f (patch) | |
tree | 8fe47b1b1b9233448297f8015ce61bbb7da13fc7 /commands/version.go | |
parent | 514e18dc27ce37a0e9a231741d616cf29d50d610 (diff) |
Add tpl/site and tpl/hugo
This means that the current `.Site` and ´.Hugo` is available as a globals, so you can do `site.IsServer`, `hugo.Version` etc.
Fixes #5470
Fixes #5467
Fixes #5503
Diffstat (limited to 'commands/version.go')
-rw-r--r-- | commands/version.go | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/commands/version.go b/commands/version.go index b85f53725..287950a2d 100644 --- a/commands/version.go +++ b/commands/version.go @@ -14,16 +14,9 @@ package commands import ( - "fmt" - "runtime" - "strings" - - jww "github.com/spf13/jwalterweatherman" - - "github.com/gohugoio/hugo/helpers" - "github.com/gohugoio/hugo/hugolib" - "github.com/gohugoio/hugo/resource/tocss/scss" + "github.com/gohugoio/hugo/common/hugo" "github.com/spf13/cobra" + jww "github.com/spf13/jwalterweatherman" ) var _ cmder = (*versionCmd)(nil) @@ -47,29 +40,5 @@ func newVersionCmd() *versionCmd { } func printHugoVersion() { - jww.FEEDBACK.Println(hugoVersionString()) -} - -func hugoVersionString() string { - 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 { - buildDate = "unknown" - } - - return fmt.Sprintf("%s %s %s BuildDate: %s", program, version, osArch, buildDate) - + jww.FEEDBACK.Println(hugo.BuildVersionString()) } |