diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-04-09 09:07:22 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-04-09 09:07:22 +0300 |
commit | 9b83f45b6dcafa6e50df80a4786d6a36400a47fe (patch) | |
tree | 82083a96cfd17548a1282de90b4a4a301dbc7df5 /commands | |
parent | 7fdd2b95e20f322b0a47f63ff1010a04f47ce67b (diff) |
Add complete dependency list in "hugo env -v"
Fixes #8400
Diffstat (limited to 'commands')
-rw-r--r-- | commands/env.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/commands/env.go b/commands/env.go index 975c3bd0a..65808b1be 100644 --- a/commands/env.go +++ b/commands/env.go @@ -16,6 +16,8 @@ package commands import ( "runtime" + "github.com/gohugoio/hugo/common/hugo" + "github.com/spf13/cobra" jww "github.com/spf13/jwalterweatherman" ) @@ -31,15 +33,28 @@ func newEnvCmd() *envCmd { baseCmd: newBaseCmd(&cobra.Command{ Use: "env", Short: "Print Hugo version and environment info", - Long: `Print Hugo version and environment info. This is useful in Hugo bug reports.`, + Long: `Print Hugo version and environment info. This is useful in Hugo bug reports. + +If you add the -v flag, you will get a full dependency list. +`, RunE: func(cmd *cobra.Command, args []string) error { printHugoVersion() jww.FEEDBACK.Printf("GOOS=%q\n", runtime.GOOS) jww.FEEDBACK.Printf("GOARCH=%q\n", runtime.GOARCH) jww.FEEDBACK.Printf("GOVERSION=%q\n", runtime.Version()) + isVerbose, _ := cmd.Flags().GetBool("verbose") + + if isVerbose { + deps := hugo.GetDependencyList() + for _, dep := range deps { + jww.FEEDBACK.Printf("%s\n", dep) + } + } + return nil }, }), } + } |