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 output formats to more commands than just zarf version #3224

Open
mkcp opened this issue Nov 8, 2024 · 3 comments
Open

Add output formats to more commands than just zarf version #3224

mkcp opened this issue Nov 8, 2024 · 3 comments
Labels
enhancement ✨ New feature or request

Comments

@mkcp
Copy link
Contributor

mkcp commented Nov 8, 2024

Is your feature request related to a problem? Please describe.

With the addition of structured logging #2576 it's become clear that structured data has user value in outputs not just diagnostic logs. Currently most output, like in zarf package list is printed using pterm tables.

Describe the behavior you'd like

In addition to tables, being able to output json, yaml, or potentially other formats would be hugely valuable for users to script and parse zarf's output. Some utilites like gh and vault provide filtering as well. This allows users to specify only the fields they want in their output, cutting out steps in external tools later. Filtering is more of a nice to have and maybe more appropriate for a second iteration.

@Racer159 Raised the detail that zarf version has an --output / -o flag already and supports rendering to json and yaml. That's a good starting point for us extending this behavior into other commands.

Additional context

This shouldn't be too difficult to implement because, at least as far as I could tell writing this, all of the table printing is well contained to cmd. Swapping out the printer from message, or extracting it into a more configurable layer shouldn't require any significant architecture changes - just pass the data to a new renderer.

@mkcp mkcp added the enhancement ✨ New feature or request label Nov 8, 2024
@mkcp mkcp added this to Zarf Nov 8, 2024
@github-project-automation github-project-automation bot moved this to Triage in Zarf Nov 8, 2024
@mkcp
Copy link
Contributor Author

mkcp commented Nov 8, 2024

@rjferguson21 Appreciate the request, let us know what you think and if there's anything you'd like us to add.

@mkcp
Copy link
Contributor Author

mkcp commented Nov 8, 2024

Some prior work for ideas:

Vault -format with tables, json, yaml, and jsonx (scroll down to -format): https://developer.hashicorp.com/vault/docs/commands
k8s jsonpath https://kubernetes.io/docs/reference/kubectl/jsonpath/
GH -json formatting options: https://cli.github.com/manual/gh_help_formatting

@mkcp mkcp changed the title Add output formats Add output formats to more commands than just zarf version Nov 8, 2024
@mkcp
Copy link
Contributor Author

mkcp commented Dec 5, 2024

Related #3226

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
Status: Triage
Development

No branches or pull requests

1 participant