diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-28 17:22:08 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-28 17:22:08 +0100 |
commit | f08ea02d24d42929676756950f3affaca7fd8c01 (patch) | |
tree | dcff64430e280d319de79d7582681dd94db0ab47 | |
parent | 016398ffe2e0a073453cf46a9d6bf72d693c11e5 (diff) |
commands: Deprecate CLI flags canonifyURLs, pluralizeListTitles, preserveTaxonomyNames, uglyURLs
You can of course still set them in site config.
Fixes #4347
-rw-r--r-- | commands/hugo.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/commands/hugo.go b/commands/hugo.go index c9f073483..d24c8cebb 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -509,8 +509,21 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) { } +var deprecatedFlags = map[string]bool{ + strings.ToLower("uglyURLs"): true, + strings.ToLower("pluralizeListTitles"): true, + strings.ToLower("preserveTaxonomyNames"): true, + strings.ToLower("canonifyURLs"): true, +} + func (c *commandeer) setValueFromFlag(flags *flag.FlagSet, key string) { if flags.Changed(key) { + if _, deprecated := deprecatedFlags[strings.ToLower(key)]; deprecated { + msg := fmt.Sprintf(`Set "%s = true" in your config.toml. +If you need to set this configuration value from the command line, set it via an OS environment variable: "HUGO_%s=true hugo"`, key, strings.ToUpper(key)) + // Remove in Hugo 0.37 + helpers.Deprecated("hugo", "--"+key+" flag", msg, false) + } f := flags.Lookup(key) c.Set(key, f.Value.String()) } |