Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON output to list command #19

Merged
merged 2 commits into from
Mar 23, 2024
Merged

Add JSON output to list command #19

merged 2 commits into from
Mar 23, 2024

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 <[email protected]>
@wagoodman wagoodman changed the title add JSON output Add JSON output Mar 22, 2024
Signed-off-by: Alex Goodman <[email protected]>
@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
3 checks passed
@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