mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-30 09:01:22 +00:00
parent
3cea2932e1
commit
ce84b524f4
1 changed files with 20 additions and 8 deletions
|
@ -19,6 +19,7 @@ import (
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/helpers"
|
"github.com/gohugoio/hugo/helpers"
|
||||||
"github.com/gohugoio/hugo/hugolib"
|
"github.com/gohugoio/hugo/hugolib"
|
||||||
|
"github.com/gohugoio/hugo/resource/tocss/scss"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
jww "github.com/spf13/jwalterweatherman"
|
jww "github.com/spf13/jwalterweatherman"
|
||||||
)
|
)
|
||||||
|
@ -44,13 +45,24 @@ func newVersionCmd() *versionCmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
func printHugoVersion() {
|
func printHugoVersion() {
|
||||||
if hugolib.CommitHash == "" {
|
program := "Hugo Static Site Generator"
|
||||||
if hugolib.BuildDate == "" {
|
|
||||||
jww.FEEDBACK.Printf("Hugo Static Site Generator v%s %s/%s\n", helpers.CurrentHugoVersion, runtime.GOOS, runtime.GOARCH)
|
version := "v" + helpers.CurrentHugoVersion.String()
|
||||||
} else {
|
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)
|
version += "-" + strings.ToUpper(hugolib.CommitHash)
|
||||||
}
|
}
|
||||||
} else {
|
if scss.Supports() {
|
||||||
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)
|
version += "/extended"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
osArch := runtime.GOOS + "/" + runtime.GOARCH
|
||||||
|
|
||||||
|
var buildDate string
|
||||||
|
if hugolib.BuildDate != "" {
|
||||||
|
buildDate = hugolib.BuildDate
|
||||||
|
} else {
|
||||||
|
buildDate = "unknown"
|
||||||
|
}
|
||||||
|
|
||||||
|
jww.FEEDBACK.Println(program, version, osArch, "BuildDate:", buildDate)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue