mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
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.
This commit is contained in:
parent
40d05f12a7
commit
50d9046b64
1 changed files with 6 additions and 3 deletions
|
@ -41,6 +41,8 @@ Complete documentation is available at http://hugo.spf13.com`,
|
||||||
build()
|
build()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
var hugoCmdV *cobra.Command
|
||||||
|
|
||||||
|
|
||||||
var BuildWatch, Draft, UglyUrls, Verbose bool
|
var BuildWatch, Draft, UglyUrls, Verbose bool
|
||||||
var Source, Destination, BaseUrl, CfgFile string
|
var Source, Destination, BaseUrl, CfgFile string
|
||||||
|
@ -67,20 +69,21 @@ func init() {
|
||||||
HugoCmd.PersistentFlags().StringVar(&CfgFile, "config", "", "config file (default is path/config.yaml|json|toml)")
|
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.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")
|
HugoCmd.Flags().BoolVarP(&BuildWatch, "watch", "w", false, "watch filesystem for changes and recreate as needed")
|
||||||
|
hugoCmdV = HugoCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitializeConfig() {
|
func InitializeConfig() {
|
||||||
Config = hugolib.SetupConfig(&CfgFile, &Source)
|
Config = hugolib.SetupConfig(&CfgFile, &Source)
|
||||||
|
|
||||||
if HugoCmd.PersistentFlags().Lookup("build-drafts").Changed {
|
if hugoCmdV.PersistentFlags().Lookup("build-drafts").Changed {
|
||||||
Config.BuildDrafts = Draft
|
Config.BuildDrafts = Draft
|
||||||
}
|
}
|
||||||
|
|
||||||
if HugoCmd.PersistentFlags().Lookup("uglyurls").Changed {
|
if hugoCmdV.PersistentFlags().Lookup("uglyurls").Changed {
|
||||||
Config.UglyUrls = UglyUrls
|
Config.UglyUrls = UglyUrls
|
||||||
}
|
}
|
||||||
|
|
||||||
if HugoCmd.PersistentFlags().Lookup("verbose").Changed {
|
if hugoCmdV.PersistentFlags().Lookup("verbose").Changed {
|
||||||
Config.Verbose = Verbose
|
Config.Verbose = Verbose
|
||||||
}
|
}
|
||||||
if BaseUrl != "" {
|
if BaseUrl != "" {
|
||||||
|
|
Loading…
Reference in a new issue