anchore / binny

Manage a directory of binaries without a package manager
Apache License 2.0
21 stars 1 forks source link

Add JSON output to list command #19

Closed wagoodman closed 5 months ago

wagoodman commented 5 months ago

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