shithub: hugo

Download patch

ref: 50d9046b648044d421ec745869141b758c76a879
parent: 40d05f12a7669f349d231448eaefe907b795a35b
author: Michael D. Johas Teener <[email protected]>
date: Tue Nov 12 12:36:23 EST 2013

remove initialization loop error from compile

copied HugoCmd to a local var, initialize that variable in the init
func, and then use the local var in the InitializeConfig func.

--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -41,7 +41,9 @@
 		build()
 	},
 }
+var hugoCmdV *cobra.Command
 
+
 var BuildWatch, Draft, UglyUrls, Verbose bool
 var Source, Destination, BaseUrl, CfgFile string
 
@@ -67,20 +69,21 @@
 	HugoCmd.PersistentFlags().StringVar(&CfgFile, "config", "", "config file (default is path/config.yaml|json|toml)")
 	HugoCmd.PersistentFlags().BoolVar(&nitro.AnalysisOn, "stepAnalysis", false, "display memory and timing of different steps of the program")
 	HugoCmd.Flags().BoolVarP(&BuildWatch, "watch", "w", false, "watch filesystem for changes and recreate as needed")
+	hugoCmdV = HugoCmd
 }
 
 func InitializeConfig() {
 	Config = hugolib.SetupConfig(&CfgFile, &Source)
 
-	if HugoCmd.PersistentFlags().Lookup("build-drafts").Changed {
+	if hugoCmdV.PersistentFlags().Lookup("build-drafts").Changed {
 		Config.BuildDrafts = Draft
 	}
 
-	if HugoCmd.PersistentFlags().Lookup("uglyurls").Changed {
+	if hugoCmdV.PersistentFlags().Lookup("uglyurls").Changed {
 		Config.UglyUrls = UglyUrls
 	}
 
-	if HugoCmd.PersistentFlags().Lookup("verbose").Changed {
+	if hugoCmdV.PersistentFlags().Lookup("verbose").Changed {
 		Config.Verbose = Verbose
 	}
 	if BaseUrl != "" {