Better organization of loading defaults - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit fd5cf9ac8d9c8587f2ac2f5a58c4b3bcd52f4896
DIR parent bdb187e482e14c6b8502caf41d1c4c3bcbbb57b0
HTML Author: spf13 <steve.francia@gmail.com>
Date: Wed, 20 May 2015 18:50:32 -0400
Better organization of loading defaults
Diffstat:
M commands/hugo.go | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
---
DIR diff --git a/commands/hugo.go b/commands/hugo.go
@@ -119,17 +119,7 @@ func init() {
You need to open cmd.exe and run it from there.`
}
-// InitializeConfig initializes a config file with sensible default configuration flags.
-func InitializeConfig() {
- viper.SetConfigFile(CfgFile)
- viper.AddConfigPath(Source)
- err := viper.ReadInConfig()
- if err != nil {
- jww.ERROR.Println("Unable to locate Config file. Perhaps you need to create a new site. Run `hugo help new` for details")
- }
-
- viper.RegisterAlias("indexes", "taxonomies")
-
+func LoadDefaultSettings() {
viper.SetDefault("Watch", false)
viper.SetDefault("MetaDataFormat", "toml")
viper.SetDefault("DisableRSS", false)
@@ -164,6 +154,20 @@ func InitializeConfig() {
viper.SetDefault("Blackfriday", helpers.NewBlackfriday())
viper.SetDefault("RSSUri", "index.xml")
viper.SetDefault("SectionPagesMenu", "")
+}
+
+// InitializeConfig initializes a config file with sensible default configuration flags.
+func InitializeConfig() {
+ viper.SetConfigFile(CfgFile)
+ viper.AddConfigPath(Source)
+ err := viper.ReadInConfig()
+ if err != nil {
+ jww.ERROR.Println("Unable to locate Config file. Perhaps you need to create a new site. Run `hugo help new` for details")
+ }
+
+ viper.RegisterAlias("indexes", "taxonomies")
+
+ LoadDefaultSettings()
if hugoCmdV.PersistentFlags().Lookup("buildDrafts").Changed {
viper.Set("BuildDrafts", Draft)