Skip to content

Commit

Permalink
commands: Deprecate CLI flags canonifyURLs, pluralizeListTitles, pres…
Browse files Browse the repository at this point in the history
…erveTaxonomyNames, uglyURLs

You can of course still set them in site config.

Fixes #4347
  • Loading branch information
bep committed Jan 28, 2018
1 parent 016398f commit f08ea02
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions commands/hugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit f08ea02

Please sign in to comment.