Skip to content

Add support for --jq or --format=jsonpath='$.store.id' #395

@jcchavezs

Description

@jcchavezs

CLI can output result in JSON format but it does not provide means to transform the output which is handy in more standardized environments like Kubernetes. For example in the readme of the CLI the suggestion to obtain the store ID is

export FGA_STORE_ID=$(fga store create --model model.fga | jq -r .store.id)

which is fine when you are in local but it imposes difficulties in container environments because e.g. the container that includes cli does not include JQ so doing this transformation would require either 2 init containers or create an image that has both cli and jq.

This is not a new issue, that is why tools like kubectl or gh include output transformations support.

For example:

  • kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.status.startTime}{'\n'}{end}"
  • gh pr list --json author --jq '.[].author.login'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions