mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-14 23:33:27 -04:00
Fix crash with "config", "check" and "benchmark"
The crash was introduced by commit 00d04774 in PR #1652 where access to NoTimes was attempted even though --noTimes was not defined for the config, check and benchmark commands. Special thanks to @bep for the heads-up! See also #1624 - CLI UX: Flags shouldn't be global
This commit is contained in:
parent
69c28985ea
commit
cd062623bd
@ -310,9 +310,10 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
|
|||||||
if cmdV.Flags().Lookup("ignoreCache").Changed {
|
if cmdV.Flags().Lookup("ignoreCache").Changed {
|
||||||
viper.Set("IgnoreCache", IgnoreCache)
|
viper.Set("IgnoreCache", IgnoreCache)
|
||||||
}
|
}
|
||||||
if cmdV.Flags().Lookup("noTimes").Changed {
|
}
|
||||||
viper.Set("NoTimes", NoTimes)
|
|
||||||
}
|
if hugoCmdV.Flags().Lookup("noTimes").Changed {
|
||||||
|
viper.Set("NoTimes", NoTimes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if BaseURL != "" {
|
if BaseURL != "" {
|
||||||
|
@ -148,6 +148,10 @@ func server(cmd *cobra.Command, args []string) error {
|
|||||||
viper.Set("PublishDir", "/")
|
viper.Set("PublishDir", "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if serverCmd.Flags().Lookup("noTimes").Changed {
|
||||||
|
viper.Set("NoTimes", NoTimes)
|
||||||
|
}
|
||||||
|
|
||||||
if err := build(serverWatch); err != nil {
|
if err := build(serverWatch); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user