Skip to content

Support formatting lists as markdown table #2194

@unclev

Description

@unclev

Is there an existing issue for this?

  • There is no existing issue for this feature

What are you currently unable to do

Format the tables put out form the incus … list command as markdown table. Would be usful for copying list command output to a markdown-base documentation.

Current options

$ incus remote list
+-----------------+------------------------------------+---------------+-------------+--------+--------+--------+
|      NAME       |                URL                 |   PROTOCOL    |  AUTH TYPE  | PUBLIC | STATIC | GLOBAL |
+-----------------+------------------------------------+---------------+-------------+--------+--------+--------+
| docker          | https://docker.io                  | oci           | none        | YES    | NO     | NO     |
+-----------------+------------------------------------+---------------+-------------+--------+--------+--------+
| images          | https://images.linuxcontainers.org | simplestreams | none        | YES    | NO     | NO     |
+-----------------+------------------------------------+---------------+-------------+--------+--------+--------+
| local (current) | unix://                            | incus         | file access | NO     | YES    | NO     |
+-----------------+------------------------------------+---------------+-------------+--------+--------+--------+
| quay            | https://quay.io                    | oci           | none        | YES    | NO     | NO     |
+-----------------+------------------------------------+---------------+-------------+--------+--------+--------+

$ incus remote list --format=csv
docker,https://docker.io,oci,none,YES,NO,NO
images,https://images.linuxcontainers.org,simplestreams,none,YES,NO,NO
local (current),unix://,incus,file access,NO,YES,NO
quay,https://quay.io,oci,none,YES,NO,NO

Current workarounds

  1. Edit the incus … list output.
  2. Use incus … list --format=csv, and then an editors's 3rd-party "CSV to markdown table" extension.
    This gives slightly different format (with left-aligned header)
    | docker          | https://docker.io                  | oci           | none        | YES | NO  | NO  |
    | :-------------- | :--------------------------------- | :------------ | :---------- | :-- | :-- | :-- |
    | images          | https://images.linuxcontainers.org | simplestreams | none        | YES | NO  | NO  |
    | local (current) | unix://                            | incus         | file access | NO  | YES | NO  |
    | quay            | https://quay.io                    | oci           | none        | YES | NO  | NO  |
    
    It lacks headers, - edit to add headers.
    NAME URL PROTOCOL AUTH TYPE PUBLIC STATIC GLOBAL
    docker https://docker.io oci none YES NO NO
    images https://images.linuxcontainers.org simplestreams none YES NO NO
    local (current) unix:// incus file access NO YES NO
    quay https://quay.io oci none YES NO NO

What do you think would need to be added

incus remote list --format=md
|      NAME       |                URL                 |   PROTOCOL    |  AUTH TYPE  | PUBLIC | STATIC | GLOBAL |
| --------------- | ---------------------------------- | ------------- | ----------- | ------ | ------ | ------ |
| docker          | https://docker.io                  | oci           | none        | YES    | NO     | NO     |
| images          | https://images.linuxcontainers.org | simplestreams | none        | YES    | NO     | NO     |
| local (current) | unix://                            | incus         | file access | NO     | YES    | NO     |
| quay            | https://quay.io                    | oci           | none        | YES    | NO     | NO     |

This also more conciese than the default table option. (Personally I would like if markdown table is the default option).

When directly copied/pasted into a markdown document

NAME URL PROTOCOL AUTH TYPE PUBLIC STATIC GLOBAL
docker https://docker.io oci none YES NO NO
images https://images.linuxcontainers.org simplestreams none YES NO NO
local (current) unix:// incus file access NO YES NO
quay https://quay.io oci none YES NO NO

Metadata

Metadata

Assignees

Labels

EasyGood for new contributors

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions