From 4835f9e898350ac49d68fba2343a71ceb29e6897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 17 Feb 2024 12:32:25 +0100 Subject: [PATCH] commands: Fix --clock with the list command Fixes #11888 --- commands/list.go | 3 +-- testscripts/commands/list.txt | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/list.go b/commands/list.go index 41a45e402..8debe5ca5 100644 --- a/commands/list.go +++ b/commands/list.go @@ -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" @@ -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]) } diff --git a/testscripts/commands/list.txt b/testscripts/commands/list.txt index 42d74cec7..8cbf93266 100644 --- a/testscripts/commands/list.txt +++ b/testscripts/commands/list.txt @@ -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"]