Skip to content

feat(flux get): add --output flag, yaml only#5782

Open
mtfurlan wants to merge 1 commit intofluxcd:mainfrom
mtfurlan:feat/get-output-yaml
Open

feat(flux get): add --output flag, yaml only#5782
mtfurlan wants to merge 1 commit intofluxcd:mainfrom
mtfurlan:feat/get-output-yaml

Conversation

@mtfurlan
Copy link
Copy Markdown

Copied the flag syntax from kubectl --output so it can be extended later
without breaking changes.

It's not integrated terribly well, but the next step would be to
abstract the printing so we can switch out printers more cleanly and
also pick which information is rendered for each printing format, and I
do not know go or this codebase well enough to do that yet.

Signed-off-by: Mara Furland mara@fur.land

@mtfurlan
Copy link
Copy Markdown
Author

mtfurlan commented Mar 23, 2026

zero rows print nothing—fine if deliberate.

Maybe a warning on stderr would be nice, but if you're doing all resources it's going to be quite hard to check.

YamlPrinter assumes len(row) >= len(header); a short row would panic

It doesn't panic, but it does assume that header[i] maps to row[i], so if headers is short, then it just won't add the row
You did cause me to notice --no-headers though, so that's fixed

I'm still not sure how to fix the boolean output though EDIT: I did it!

@mtfurlan mtfurlan force-pushed the feat/get-output-yaml branch from e7b18ee to 811cc25 Compare March 23, 2026 15:17
Copied the flag syntax from kubectl --output so it can be extended later
without breaking changes.

It's not integrated terribly well, but the next step would be to
abstract the printing so we can switch out printers more cleanly and
also pick which information is rendered for each printing format, and I
do not know go or this codebase well enough to do that yet.

Signed-off-by: Mara Furland <mara@fur.land>
@mtfurlan mtfurlan force-pushed the feat/get-output-yaml branch from 811cc25 to e574419 Compare March 23, 2026 15:18
@stefanprodan
Copy link
Copy Markdown
Member

For get commands the --output should return a List type like kubectl does, having the table printed in yaml format is not something I would consider, we need to return all objects in a list.

@mtfurlan
Copy link
Copy Markdown
Author

I don't disagree, but the requests for this have existed for a few years and this is still a lot better than the current state.
Could name the output yamltable so we could do real yaml later without any breaking change?

If you can help me with a plan I can spend a little more time trying to make it do more real yaml output.
The only idea I have right now is to modify summarisable to include a getRaw(i int) any and then pass the summarisable to the printer interface, but I don't like any and I don't know go typing well enough to do this on my own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants