diff options
author | bogem <albertnigma@gmail.com> | 2016-11-22 18:47:20 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-11-22 22:06:48 +0100 |
commit | 120f6b0cf20dfc977f33e650530d866e28e52a28 (patch) | |
tree | 232ebeb1e3b3b7e356c352d6febb268e69d1059d /commands/version.go | |
parent | e1da7cb3204c6d232f4a1bdbf89ce75d8459a8b8 (diff) |
all: Use jww instead of fmt for printing
This is an attempt to unify method for printing.
Diffstat (limited to 'commands/version.go')
-rw-r--r-- | commands/version.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/commands/version.go b/commands/version.go index d64a6cf6f..348464227 100644 --- a/commands/version.go +++ b/commands/version.go @@ -14,7 +14,6 @@ package commands import ( - "fmt" "os" "path/filepath" "strings" @@ -24,6 +23,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/hugo/helpers" "github.com/spf13/hugo/hugolib" + jww "github.com/spf13/jwalterweatherman" ) var versionCmd = &cobra.Command{ @@ -32,7 +32,6 @@ var versionCmd = &cobra.Command{ Long: `All software has versions. This is Hugo's.`, RunE: func(cmd *cobra.Command, args []string) error { printHugoVersion() - return nil }, } @@ -44,9 +43,9 @@ func printHugoVersion() { formatBuildDate() // format the compile time } if hugolib.CommitHash == "" { - fmt.Printf("Hugo Static Site Generator v%s BuildDate: %s\n", helpers.HugoVersion(), hugolib.BuildDate) + jww.FEEDBACK.Printf("Hugo Static Site Generator v%s BuildDate: %s\n", helpers.HugoVersion(), hugolib.BuildDate) } else { - fmt.Printf("Hugo Static Site Generator v%s-%s BuildDate: %s\n", helpers.HugoVersion(), strings.ToUpper(hugolib.CommitHash), hugolib.BuildDate) + jww.FEEDBACK.Printf("Hugo Static Site Generator v%s-%s BuildDate: %s\n", helpers.HugoVersion(), strings.ToUpper(hugolib.CommitHash), hugolib.BuildDate) } } @@ -60,12 +59,12 @@ func setBuildDate() { fname, _ := osext.Executable() dir, err := filepath.Abs(filepath.Dir(fname)) if err != nil { - fmt.Println(err) + jww.ERROR.Println(err) return } fi, err := os.Lstat(filepath.Join(dir, filepath.Base(fname))) if err != nil { - fmt.Println(err) + jww.ERROR.Println(err) return } t := fi.ModTime() |