mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05: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
2 changed files with 8 additions and 3 deletions
|
@ -310,9 +310,10 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
|
|||
if cmdV.Flags().Lookup("ignoreCache").Changed {
|
||||
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 != "" {
|
||||
|
|
|
@ -148,6 +148,10 @@ func server(cmd *cobra.Command, args []string) error {
|
|||
viper.Set("PublishDir", "/")
|
||||
}
|
||||
|
||||
if serverCmd.Flags().Lookup("noTimes").Changed {
|
||||
viper.Set("NoTimes", NoTimes)
|
||||
}
|
||||
|
||||
if err := build(serverWatch); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue