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 support for coloured pretty print JSON output #2999

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

brutus333
Copy link

First of all, thank you for this great project - it is helping lot of people to improve their productivity with kubernetes management.

This PR is adding colored, prettified JSON output to k9s.

I tried to follow the conventions in the initial code. I only added a new package (jsonpretty) responsible with writing modified JSON log lines.

The coloring is based on simple rules for value type and on simple regex rules for map keys and values.

I didn't implement a configuration section for the coloring rules yet, the rules are hardcoded for now. However, if you like the idea and give me few hints, I can also extend the configuration with these rules as part of this PR.

Having regexes in the configuration files doesn't look particularly well suited for consumption, maybe we can implement something smarter like CEL rules or simple OR of list entries.

For the same reason (unfinished work) I didn't extend the documentation yet.

@brutus333
Copy link
Author

Related issue: #2998

@derailed derailed added the needs-tlc Pr needs additional updates label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-tlc Pr needs additional updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants