mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
commands: Make the --poll flag a duration
So you can do: ``` hugo server --poll 700ms ``` See #8720
This commit is contained in:
@@ -29,6 +29,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/common/types"
|
||||
|
||||
"github.com/gohugoio/hugo/common/paths"
|
||||
|
||||
"github.com/gohugoio/hugo/common/constants"
|
||||
@@ -523,13 +525,9 @@ But this also means that your site configuration may not do what you expect. If
|
||||
timeout := 30 * time.Second
|
||||
if cfg.Language.IsSet("timeout") {
|
||||
v := cfg.Language.Get("timeout")
|
||||
if n := cast.ToInt(v); n > 0 {
|
||||
timeout = time.Duration(n) * time.Millisecond
|
||||
} else {
|
||||
d, err := time.ParseDuration(cast.ToString(v))
|
||||
if err == nil {
|
||||
timeout = d
|
||||
}
|
||||
d, err := types.ToDurationE(v)
|
||||
if err == nil {
|
||||
timeout = d
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user