Skip to content

Commit

Permalink
commands: Fix --clock with the list command
Browse files Browse the repository at this point in the history
Fixes #11888
  • Loading branch information
bep committed Feb 17, 2024
1 parent 5bdda0b commit 4835f9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions commands/list.go
Expand Up @@ -23,7 +23,6 @@ import (
"time"

"github.com/bep/simplecobra"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/resources/page"
"github.com/gohugoio/hugo/resources/resource"
Expand All @@ -46,7 +45,7 @@ func newListCommand() *listCommand {

list := func(cd *simplecobra.Commandeer, r *rootCommand, shouldInclude func(page.Page) bool, opts ...any) error {
bcfg := hugolib.BuildCfg{SkipRender: true}
cfg := config.New()
cfg := flagsToCfg(cd, nil)
for i := 0; i < len(opts); i += 2 {
cfg.Set(opts[i].(string), opts[i+1])
}
Expand Down
3 changes: 3 additions & 0 deletions testscripts/commands/list.txt
Expand Up @@ -28,6 +28,9 @@ stdout 'expired.md'
stdout 'draftexpired.md'
stdout 'draftfuture.md'

hugo list expired --clock 2000-01-01T00:00:00Z
! stdout 'expired.md'

-- hugo.toml --
baseURL = "https://example.org/"
disableKinds = ["taxonomy", "term"]
Expand Down

0 comments on commit 4835f9e

Please sign in to comment.