Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsatotake <doublequotation@gmail.com>2022-04-26 20:57:04 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-05-08 17:56:26 +0300
commite77ca3c105bd64c5077d823d2127f6f812a4f681 (patch)
treeebbe9c310bfab1e34f9fd2e36b738fd2a37d6f11 /commands/hugo.go
parentf2946da9e806c2bafbdd26707fe339db79bd980b (diff)
Add `clock` cli flag
Close #8787
Diffstat (limited to 'commands/hugo.go')
-rw-r--r--commands/hugo.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index 6bd0605db..43ec7e5c7 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -33,6 +33,7 @@ import (
"github.com/gohugoio/hugo/hugofs/files"
"github.com/gohugoio/hugo/tpl"
+ "github.com/gohugoio/hugo/common/htime"
"github.com/gohugoio/hugo/common/types"
"github.com/gohugoio/hugo/hugofs"
@@ -187,6 +188,7 @@ func initializeFlags(cmd *cobra.Command, cfg config.Provider) {
"buildDrafts",
"buildFuture",
"buildExpired",
+ "clock",
"uglyURLs",
"canonifyURLs",
"enableRobotsTXT",
@@ -679,7 +681,7 @@ func (c *commandeer) firstPathSpec() *helpers.PathSpec {
}
func (c *commandeer) timeTrack(start time.Time, name string) {
- elapsed := time.Since(start)
+ elapsed := htime.Since(start)
c.logger.Printf("%s in %v ms", name, int(1000*elapsed.Seconds()))
}
@@ -790,7 +792,7 @@ func (c *commandeer) fullRebuild(changeType string) {
time.Sleep(2 * time.Second)
}()
- defer c.timeTrack(time.Now(), "Rebuilt")
+ defer c.timeTrack(htime.Now(), "Rebuilt")
c.commandeerHugoState = newCommandeerHugoState()
err := c.loadConfig()
@@ -900,7 +902,7 @@ func (c *commandeer) printChangeDetected(typ string) {
c.logger.Println(msg)
const layout = "2006-01-02 15:04:05.000 -0700"
- c.logger.Println(time.Now().Format(layout))
+ c.logger.Println(htime.Now().Format(layout))
}
const (
@@ -1135,7 +1137,7 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher,
c.changeDetector.PrepareNew()
func() {
- defer c.timeTrack(time.Now(), "Total")
+ defer c.timeTrack(htime.Now(), "Total")
if err := c.rebuildSites(dynamicEvents); err != nil {
c.handleBuildErr(err, "Rebuild failed")
}