Skip to content

Add support for formatting projections#1068

Merged
stevemessick merged 2 commits into
mainfrom
format-projection
Jun 23, 2026
Merged

Add support for formatting projections#1068
stevemessick merged 2 commits into
mainfrom
format-projection

Conversation

@stevemessick

Copy link
Copy Markdown
Contributor

The --format option now supports optional gcloud-style field selection (projections) by appending a comma-separated list of fields in parentheses to the format name. E.g., --format="json(ref,reward)".

This also refactors CLI formatting to use a centralized print_results helper, reducing code duplication across commands.

TAG=agy

CONV=43417028-1d5e-4f83-b849-7a63186da785

The --format option now supports optional gcloud-style field selection (projections) by appending a comma-separated list of fields in parentheses to the format name. E.g., --format="json(ref,reward)".

This also refactors CLI formatting to use a centralized print_results helper, reducing code duplication across commands.

TAG=agy

CONV=43417028-1d5e-4f83-b849-7a63186da785
@stevemessick stevemessick requested a review from rosbo June 22, 2026 23:18
return

output_fmt = self._get_output_format(csv_display, output_format)
all_fields = self.forum_topic_fields + self.forum_comment_fields

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reasons for not using self.print_results here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just readability, simplicity. This handles the the complexity of multiple object formats coming back from the protos. Forcing use of the helper would add a lot of mapping code, or add complexity to the helper.

@stevemessick stevemessick merged commit 6e6cb93 into main Jun 23, 2026
15 checks passed
@stevemessick stevemessick deleted the format-projection branch June 23, 2026 18:59
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