shithub: hugo

Download patch

ref: df4cbbd3bdc05aa14a67b3a0a29a0db75b82e640
parent: 2e2e34a9350edec0220462aa3d47ecc9d428a0fb
author: Bjørn Erik Pedersen <[email protected]>
date: Fri Sep 21 10:27:35 EDT 2018

commands: Remove deprecated flags

--- a/commands/commands.go
+++ b/commands/commands.go
@@ -220,8 +220,6 @@
 	cmd.Flags().StringP("destination", "d", "", "filesystem path to write files to")
 	cmd.Flags().StringP("theme", "t", "", "theme to use (located in /themes/THEMENAME/)")
 	cmd.Flags().StringP("themesDir", "", "", "filesystem path to themes directory")
-	cmd.Flags().Bool("uglyURLs", false, "(deprecated) if true, use /filename.html instead of /filename/")
-	cmd.Flags().Bool("canonifyURLs", false, "(deprecated) if true, all relative URLs will be canonicalized using baseURL")
 	cmd.Flags().StringVarP(&cc.baseURL, "baseURL", "b", "", "hostname (and path) to the root, e.g. http://spf13.com/")
 	cmd.Flags().Bool("enableGitInfo", false, "add Git revision, date and author info to the pages")
 	cmd.Flags().BoolVar(&cc.gc, "gc", false, "enable to run some cleanup tasks (remove unused cache files) after the build")
@@ -229,8 +227,6 @@
 	cmd.Flags().BoolVar(&nitro.AnalysisOn, "stepAnalysis", false, "display memory and timing of different steps of the program")
 	cmd.Flags().Bool("templateMetrics", false, "display metrics about template executions")
 	cmd.Flags().Bool("templateMetricsHints", false, "calculate some improvement hints when combined with --templateMetrics")
-	cmd.Flags().Bool("pluralizeListTitles", true, "(deprecated) pluralize titles in lists using inflect")
-	cmd.Flags().Bool("preserveTaxonomyNames", false, `(deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")`)
 	cmd.Flags().BoolP("forceSyncStatic", "", false, "copy all files when static is changed.")
 	cmd.Flags().BoolP("noTimes", "", false, "don't sync modification time of files")
 	cmd.Flags().BoolP("noChmod", "", false, "don't sync permission mode of files")
--- a/commands/commands_test.go
+++ b/commands/commands_test.go
@@ -72,7 +72,7 @@
 		"--port=1366",
 		"--renderToDisk",
 		"--source=mysource",
-		"--uglyURLs"}, func(commands []cmder) {
+	}, func(commands []cmder) {
 		var sc *serverCmd
 		for _, command := range commands {
 			if b, ok := command.(commandsBuilderGetter); ok {
@@ -105,7 +105,6 @@
 
 		assert.Equal([]string{"page", "home"}, cfg.Get("disableKinds"))
 
-		assert.True(cfg.GetBool("uglyURLs"))
 		assert.True(cfg.GetBool("gc"))
 
 		// The flag is named i18n-warnings
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -233,22 +233,9 @@
 
 }
 
-var deprecatedFlags = map[string]bool{
-	strings.ToLower("uglyURLs"):              true,
-	strings.ToLower("pluralizeListTitles"):   true,
-	strings.ToLower("preserveTaxonomyNames"): true,
-	strings.ToLower("canonifyURLs"):          true,
-}
-
 func setValueFromFlag(flags *flag.FlagSet, key string, cfg config.Provider, targetKey string, force bool) {
 	key = strings.TrimSpace(key)
 	if (force && flags.Lookup(key) != nil) || 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.38
-			helpers.Deprecated("hugo", "--"+key+" flag", msg, true)
-		}
 		f := flags.Lookup(key)
 		configKey := key
 		if targetKey != "" {