lxc/incus

incus-simplestreams list -f json: does not output field names

Closed this issue · 1 comments

incus client 6.6

Issue description

"incus-simplestreams list -f json" outputs an array of arrays of strings.
There are no field names or even headings to indicate what the strings are.
It should output an array of structures, like "incus list -f json" or "incus image list -f json".

The same happens with the "yaml" format.

Steps to reproduce

  1. cd to a simplestreams directory
  2. incus-simplestreams list -f json > ~/a.json
  3. format a.json and look at it

The fix is very simple:
At the end of the file incus/cmd/incus-simplestreams/main_list.go, change

return cli.RenderTable(c.flagFormat, header, data, data)

to:

return cli.RenderTable(c.flagFormat, header, data, images)

You can either type it in quickly, or assign this to me and I will provide a pull request shortly.

This is related to #1303. I wanted to write a tool to remove old images. Having the data in json objects makes it safer to use than hardcoding column numbers.