diff options
author | satotake <doublequotation@gmail.com> | 2022-04-27 02:57:04 +0900 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-05-08 16:56:26 +0200 |
commit | e77ca3c105bd64c5077d823d2127f6f812a4f681 (patch) | |
tree | ebbe9c310bfab1e34f9fd2e36b738fd2a37d6f11 /commands/hugo.go | |
parent | f2946da9e806c2bafbdd26707fe339db79bd980b (diff) |
Add `clock` cli flag
Close #8787
Diffstat (limited to 'commands/hugo.go')
-rw-r--r-- | commands/hugo.go | 10 |
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") } |