Skip to content

Add JSON output to list command#19

Merged
wagoodman merged 2 commits intomainfrom
json-output
Mar 23, 2024
Merged

Add JSON output to list command#19
wagoodman merged 2 commits intomainfrom
json-output

Conversation

@wagoodman
Copy link
Contributor

@wagoodman wagoodman commented Mar 22, 2024

This adds a -o json option to the list command:

$ binny list -o json      
{
  "tools": [
    {
      "name": "quill",
      "wantVersion": "v0.4.1",
      "resolvedVersion": "v0.4.1",
      "installedVersion": "v0.4.1",
      "constraint": "",
      "isInstalled": true,
      "hashIsValid": true
    },
    {
      "name": "chronicle",
      "wantVersion": "v0.8.0",
      "resolvedVersion": "v0.8.0",
      "installedVersion": "v0.8.0",
      "constraint": "",
      "isInstalled": true,
      "hashIsValid": true
    },
    {
      "name": "bouncer",
      "wantVersion": "v0.4.0",
      "resolvedVersion": "v0.4.0",
      "installedVersion": "v0.4.0",
      "constraint": "",
      "isInstalled": true,
      "hashIsValid": true
    },
    {
      "name": "syft",
      "wantVersion": "v0.91.0",
      "resolvedVersion": "v0.91.0",
      "installedVersion": "v0.91.0",
      "constraint": "",
      "isInstalled": true,
      "hashIsValid": true
    }
  ]
}

Additionally, like with some github gh commands you can use --jq to filter the output:

$ binny list -o json  --jq '.tools[].wantVersion' 
v0.4.1
v0.8.0
v0.4.0
v0.91.0

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman changed the title add JSON output Add JSON output Mar 22, 2024
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman changed the title Add JSON output Add JSON output to list command Mar 23, 2024
@wagoodman wagoodman marked this pull request as ready for review March 23, 2024 15:36
@wagoodman wagoodman added the enhancement New feature or request label Mar 23, 2024
@wagoodman wagoodman merged commit 35c0e96 into main Mar 23, 2024
@wagoodman wagoodman deleted the json-output branch March 23, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant