summaryrefslogtreecommitdiffhomepage
path: root/commands
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-04-15 09:46:02 +0200
committerBjørn Erik Pedersen <[email protected]>2018-04-15 11:20:04 +0200
commit1b4e0c4161fb631add62e77f494a7e62c3619020 (patch)
tree213fde1084f670ed13ee23f2ec7501e6e73f90ad /commands
parent27a524b0905ec73c1eef233f94700feb9f465011 (diff)
downloadhugo-1b4e0c4161fb631add62e77f494a7e62c3619020.tar.gz
hugo-1b4e0c4161fb631add62e77f494a7e62c3619020.zip
commands: Remove accidental and breaking space in baseURL flag
And added key-trimming to prevent future mishaps. See #4607
Diffstat (limited to 'commands')
-rw-r--r--commands/commands_test.go1
-rw-r--r--commands/hugo.go3
2 files changed, 3 insertions, 1 deletions
diff --git a/commands/commands_test.go b/commands/commands_test.go
index 2eefaa2ea..376ca7976 100644
--- a/commands/commands_test.go
+++ b/commands/commands_test.go
@@ -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"))
diff --git a/commands/hugo.go b/commands/hugo.go
index 41c06c026..e2d447768 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -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.