mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-13 20:24:00 +02: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:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user