Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'helpers')
-rw-r--r--helpers/general.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/helpers/general.go b/helpers/general.go
index c6adc855a..d97c78454 100644
--- a/helpers/general.go
+++ b/helpers/general.go
@@ -31,6 +31,7 @@ import (
"github.com/spf13/cast"
bp "github.com/spf13/hugo/bufferpool"
jww "github.com/spf13/jwalterweatherman"
+ "github.com/spf13/pflag"
"github.com/spf13/viper"
)
@@ -428,3 +429,17 @@ func DoArithmetic(a, b interface{}, op rune) (interface{}, error) {
return nil, errors.New("There is no such an operation")
}
}
+
+// NormalizeHugoFlagsFunc facilitates transitions of Hugo command-line flags,
+// e.g. --baseUrl to --baseURL, --uglyUrls to --uglyURLs
+func NormalizeHugoFlagsFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
+ switch name {
+ case "baseUrl":
+ name = "baseURL"
+ break
+ case "uglyUrls":
+ name = "uglyURLs"
+ break
+ }
+ return pflag.NormalizedName(name)
+}