`hugo list` now only outputs CSV?

I don’t know when this changed, but despite documentation claiming that the default output of all hugo list commands is TOML, it now outputs CSV and ignores the --format option completely.

% hugo version
hugo v0.112.3+extended darwin/amd64 BuildDate=unknown

% hugo list expired
path,slug,title,date,expiryDate,publishDate,draft,permalink
content/quotes/305197.md,,J,2019-02-21T07:59:43-08:00,2019-02-21T07:59:43-08:00,2019-02-21T07:59:43-08:00,false,https://(redacted)/quotes/305197/
content/quotes/305126.md,,(undisclosed),2017-07-04T14:10:49-07:00,2017-07-04T14:10:49-07:00,2017-07-04T14:10:49-07:00,false,https://(redacted)/quotes/305126/
content/post/0025/002523.md,,Lost in translation,2006-04-19T14:26:50-04:00,2017-10-15T00:00:00-04:00,2006-04-19T14:26:50-04:00,false,https://(redacted)/archive/2006/04/002523/

Please let me know where that appears in the documentation.

v0.111.3

$ hugo list all

path,slug,title,date,expiryDate,publishDate,draft,permalink
content/posts/post-3.md,,Post 3,2023-05-25T16:40:35-07:00,2023-04-25T16:43:22-07:00,2023-05-25T16:40:35-07:00,false,https://example.org/posts/post-3/
content/posts/post-2.md,,Post 2,2023-05-25T16:40:34-07:00,0001-01-01T00:00:00Z,2023-05-25T16:40:34-07:00,true,https://example.org/posts/post-2/
content/posts/post-1.md,,Post 1,2023-05-25T16:40:33-07:00,0001-01-01T00:00:00Z,2023-05-25T16:40:33-07:00,true,https://example.org/posts/post-1/

$ hugo list expired

content/posts/post-3.md,2023-04-25T16:43:22-07:00

v0.112.3

$ hugo list all

path,slug,title,date,expiryDate,publishDate,draft,permalink
content/posts/post-3.md,,Post 3,2023-05-25T16:40:35-07:00,2023-04-25T16:43:22-07:00,2023-05-25T16:40:35-07:00,false,https://example.org/posts/post-3/
content/posts/post-2.md,,Post 2,2023-05-25T16:40:34-07:00,0001-01-01T00:00:00Z,2023-05-25T16:40:34-07:00,true,https://example.org/posts/post-2/
content/posts/post-1.md,,Post 1,2023-05-25T16:40:33-07:00,0001-01-01T00:00:00Z,2023-05-25T16:40:33-07:00,true,https://example.org/posts/post-1/
content/_index.md,,@@TITLE@@,2021-01-01T00:00:00Z,0001-01-01T00:00:00Z,2021-01-01T00:00:00Z,false,https://example.org/

$ hugo list expired

path,slug,title,date,expiryDate,publishDate,draft,permalink
content/posts/post-3.md,,Post 3,2023-05-25T16:40:35-07:00,2023-04-25T16:43:22-07:00,2023-05-25T16:40:35-07:00,false,https://example.org/posts/post-3/

So with the latest release we have consistent output with all commands.

Was there a version that supported the --format flag when listing content? I went back to v0.54.0 and didn’t see the flag.

$ hugo version

Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z

$ hugo list help

Listing out various types of content.

List requires a subcommand, e.g. `hugo list drafts`.

Usage:
  hugo list [command]

Available Commands:
  drafts      List all drafts
  expired     List all posts already expired
  future      List all posts dated in the future

Flags:
  -h, --help            help for list
  -s, --source string   filesystem path to read files relative from

Global Flags:
      --config string      config file (default is path/config.yaml|json|toml)
      --configDir string   config dir (default "config")
      --debug              debug output
      --log                enable Logging
      --logFile string     log File path (if set, logging enabled automatically)
      --quiet              build in quiet mode
  -v, --verbose            verbose output
      --verboseLog         verbose logging

Use "hugo list [command] --help" for more information about a command.

man hugo-list

In any case, I don’t see the format change in any recent release notes.

Got it. The --format flag appears in the:

  • auto-completion suggestions for hugo list
  • man page for hugo list
  • generated doc pages (hugo gen doc)

From what I can see, the --format flag did not appear in these with v0.111.3 and earlier (and threw an error if you tried to use it), and in v0.112.0 and later the flag doesn’t do anything.

So we need to remove the flag from the three help sources above:
https://github.com/gohugoio/hugo/issues/11022

Regarding the newly consistent output between hugo list all and hugo list xxx, you’re right, it’s not in the release notes—sorry about that.

https://discourse.gohugo.io/t/hugo-0-112-0-released/44492/14?u=jmooring

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.