Make noTimes command flag work
authorTatsushi Demachi <tdemachi@gmail.com>
Tue, 1 Dec 2015 16:48:52 +0000 (01:48 +0900)
committerAnthony Fok <foka@debian.org>
Tue, 1 Dec 2015 17:01:44 +0000 (10:01 -0700)
Hugo command provides "noTimes" flag but it doesn't affect synced files
timestamp regardless of whether the flag is specified or not.

This fixes it by adding a flag check and overwriting configuration if it
is specified.

Fix #1583

commands/hugo.go

index c275fccc9ac77020d640dcd1897080655149ad53..ea81797800aa7e2f5c30f9605a49263b74e0b60b 100644 (file)
@@ -244,6 +244,11 @@ func InitializeConfig() {
        if hugoCmdV.PersistentFlags().Lookup("logFile").Changed {
                viper.Set("LogFile", LogFile)
        }
+
+       if hugoCmdV.Flags().Lookup("noTimes").Changed {
+               viper.Set("noTimes", NoTimes)
+       }
+
        if BaseURL != "" {
                if !strings.HasSuffix(BaseURL, "/") {
                        BaseURL = BaseURL + "/"