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

Enabled JSON and ZSON color by default #5114

Merged
merged 1 commit into from
Apr 26, 2024
Merged

Enabled JSON and ZSON color by default #5114

merged 1 commit into from
Apr 26, 2024

Conversation

mattnibs
Copy link
Collaborator

@mattnibs mattnibs commented Apr 23, 2024

This commit changes the behavior of the ZSON and JSON outputs where if the writer is writing to a terminal the output will be colorized- independent of whether the output is indented or not.

@mattnibs mattnibs requested a review from a team April 23, 2024 18:01
This commit changes the behavior of the ZSON and JSON outputs where if
the writer is writing to a terminal the output will be colorized-
independent of whether the output is indented or not.
Comment on lines +26 to +29
colorDisabled bool
}

func NewFormatter(pretty int, colorDisabled bool, persist *regexp.Regexp) *Formatter {
Copy link
Member

Choose a reason for hiding this comment

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

I think this would be clearer with color bool instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The problem with this is that color = true wouldn't necessarily mean color is enabled since it depends when the writer is outputting to a terminal.

Copy link
Member

@nwt nwt Apr 26, 2024

Choose a reason for hiding this comment

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

Ah, right. To make that work we'd need to get rid of pkg/terminal/color.Enabled. Let's do that later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed I think we should get rid of that but yeah, later.

@mattnibs mattnibs merged commit f0311c2 into main Apr 26, 2024
3 checks passed
@mattnibs mattnibs deleted the color-default branch April 26, 2024 00:11
@philrz philrz linked an issue Apr 26, 2024 that may be closed by this pull request
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.

Formatted ("pretty print") JSON output
2 participants