mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-27 21:51:13 +00:00
commands: Remove accidental and breaking space in baseURL flag
And added key-trimming to prevent future mishaps. See #4607
This commit is contained in:
parent
27a524b090
commit
1b4e0c4161
2 changed files with 3 additions and 1 deletions
|
@ -101,6 +101,7 @@ func TestCommandsPersistentFlags(t *testing.T) {
|
|||
assert.Equal("mylayouts", cfg.GetString("layoutDir"))
|
||||
assert.Equal("mytheme", cfg.GetString("theme"))
|
||||
assert.Equal("mythemes", cfg.GetString("themesDir"))
|
||||
assert.Equal("https://example.com/b/", cfg.GetString("baseURL"))
|
||||
|
||||
assert.Equal([]string{"page", "home"}, cfg.Get("disableKinds"))
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ func initializeFlags(cmd *cobra.Command, cfg config.Provider) {
|
|||
"templateMetricsHints",
|
||||
|
||||
// Moved from vars.
|
||||
"baseURL ",
|
||||
"baseURL",
|
||||
"buildWatch",
|
||||
"cacheDir",
|
||||
"cfgFile",
|
||||
|
@ -231,6 +231,7 @@ var deprecatedFlags = map[string]bool{
|
|||
}
|
||||
|
||||
func setValueFromFlag(flags *flag.FlagSet, key string, cfg config.Provider, targetKey string) {
|
||||
key = strings.TrimSpace(key)
|
||||
if flags.Changed(key) {
|
||||
if _, deprecated := deprecatedFlags[strings.ToLower(key)]; deprecated {
|
||||
msg := fmt.Sprintf(`Set "%s = true" in your config.toml.
|
||||
|
|
Loading…
Reference in a new issue