aboutsummaryrefslogtreecommitdiffhomepage
path: root/commands
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2023-10-26 09:38:13 +0200
committerBjørn Erik Pedersen <[email protected]>2023-10-26 20:41:19 +0200
commit71fd79a3f44101ef515349a24527e6c0b566f368 (patch)
tree4bd1763b0b09a5767ee5501b6df298fd12efc6d2 /commands
parentc4a530f104f2b0d1dd82211b77b603a07db7c181 (diff)
downloadhugo-71fd79a3f44101ef515349a24527e6c0b566f368.tar.gz
hugo-71fd79a3f44101ef515349a24527e6c0b566f368.zip
Revise the deprecation logging
This introduces a more automatic way of increasing the log levels for deprecation log statements based on the version it was deprecated. The thresholds are a little arbitrary, but * We log INFO for 6 releases * We log WARN for another 6 releases * THen ERROR (failing the build) This should give theme authors plenty of time to catch up without having the log filled with warnings.
Diffstat (limited to 'commands')
-rw-r--r--commands/commandeer.go19
1 files changed, 6 insertions, 13 deletions
diff --git a/commands/commandeer.go b/commands/commandeer.go
index b4f250a32..c3e2019b5 100644
--- a/commands/commandeer.go
+++ b/commands/commandeer.go
@@ -38,6 +38,7 @@ import (
"github.com/gohugoio/hugo/common/hstrings"
"github.com/gohugoio/hugo/common/htime"
+ "github.com/gohugoio/hugo/common/hugo"
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/common/paths"
"github.com/gohugoio/hugo/config"
@@ -50,9 +51,7 @@ import (
"github.com/spf13/cobra"
)
-var (
- errHelp = errors.New("help requested")
-)
+var errHelp = errors.New("help requested")
// Execute executes a command.
func Execute(args []string) error {
@@ -182,11 +181,9 @@ func (r *rootCommand) ConfigFromConfig(key int32, oldConf *commonConfig) (*commo
cfg: oldConf.cfg,
fs: fs,
}, nil
-
})
return cc, err
-
}
func (r *rootCommand) ConfigFromProvider(key int32, cfg config.Provider) (*commonConfig, error) {
@@ -211,7 +208,7 @@ func (r *rootCommand) ConfigFromProvider(key int32, cfg config.Provider) (*commo
if !cfg.IsSet("workingDir") {
cfg.Set("workingDir", dir)
} else {
- if err := os.MkdirAll(cfg.GetString("workingDir"), 0777); err != nil {
+ if err := os.MkdirAll(cfg.GetString("workingDir"), 0o777); err != nil {
return nil, fmt.Errorf("failed to create workingDir: %w", err)
}
}
@@ -303,7 +300,6 @@ func (r *rootCommand) ConfigFromProvider(key int32, cfg config.Provider) (*commo
})
return cc, err
-
}
func (r *rootCommand) HugFromConfig(conf *commonConfig) (*hugolib.HugoSites, error) {
@@ -348,7 +344,6 @@ func (r *rootCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args
err := b.build()
return err
}()
-
if err != nil {
return err
}
@@ -434,12 +429,13 @@ func (r *rootCommand) createLogger(running bool) (loggers.Logger, error) {
}
} else {
if r.verbose {
- helpers.Deprecated("--verbose", "use --logLevel info", false)
+ hugo.Deprecate("--verbose", "use --logLevel info", "v0.114.0")
+ hugo.Deprecate("--verbose", "use --logLevel info", "v0.114.0")
level = logg.LevelInfo
}
if r.debug {
- helpers.Deprecated("--debug", "use --logLevel debug", false)
+ hugo.Deprecate("--debug", "use --logLevel debug", "v0.114.0")
level = logg.LevelDebug
}
}
@@ -453,7 +449,6 @@ func (r *rootCommand) createLogger(running bool) (loggers.Logger, error) {
}
return loggers.New(optsLogger), nil
-
}
func (r *rootCommand) Reset() {
@@ -519,7 +514,6 @@ func applyLocalFlagsBuildConfig(cmd *cobra.Command, r *rootCommand) {
_ = cmd.Flags().SetAnnotation("cacheDir", cobra.BashCompSubdirsInDir, []string{})
cmd.Flags().StringP("contentDir", "c", "", "filesystem path to content directory")
_ = cmd.Flags().SetAnnotation("theme", cobra.BashCompSubdirsInDir, []string{"themes"})
-
}
// Flags needed to do a build (used by hugo and hugo server commands)
@@ -558,7 +552,6 @@ func applyLocalFlagsBuild(cmd *cobra.Command, r *rootCommand) {
cmd.Flags().StringSlice("disableKinds", []string{}, "disable different kind of pages (home, RSS etc.)")
cmd.Flags().Bool("minify", false, "minify any supported output format (HTML, XML etc.)")
_ = cmd.Flags().SetAnnotation("destination", cobra.BashCompSubdirsInDir, []string{})
-
}
func (r *rootCommand) timeTrack(start time.Time, name string) {