capactio / capact

Simple way to manage applications and infrastructure.
https://capact.io
Apache License 2.0
80 stars 19 forks source link

[Capact CLI] Add support for `jsonpath` output #614

Closed mszostok closed 2 years ago

mszostok commented 2 years ago

Description

Currently, in most of our tutorials/documentations, we require from user to install the jq tools For example:

capact typeinstance get {type-instance-id} -ojson | jq -r '.[0].latestResourceVersion.spec.value'

this can be simply replaced with:

capact typeinstance get {type-instance-id} -ojsonpath='.[0].latestResourceVersion.spec.value'

After https://github.com/capactio/capact/issues/489 it would be as simple as:

capact typeinstance get {type-instance-id} -ojsonpath='.spec.value'

We can re-use solution implemented in kubectl: https://github.com/kubernetes/cli-runtime/blob/e2af539b53266cfd3ee268922d3027f83de1e80a/pkg/printers/jsonpath.go#L139-L145

Reason

Requires installation of external tools for most of the happy path scenarios. This should be simplified and Capact CLI should be the only one which is needed. One 💍 to rule them all 😎 . Same as we did for https://github.com/capactio/capact/issues/328 and https://github.com/capactio/capact/issues/466.

Use cases

Acceptance Criteria