-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
gh-131952: Add color to the json
CLI
#132126
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much of a performance impact does this have?
It doesn't matter here. |
I think we might not need that, |
json.tool
CLI.json.tool
CLI
What about CLIs? they would be broken if data is piped? |
AFAIU they wouldn't (and local testing confirms that), see this comment from Hugo: #131952 (comment) |
@tomasr8 thank you for taking the time to look into it. couple of notes regarding the keys 1) could you make them a different color from the string values? 2) could you make them bold? this is what jq does and i think it provides a good ux https://static1.howtogeekimages.com/wordpress/wp-content/uploads/2020/01/5-7.png |
That should be in theory possible, we can distinguish keys from string literals since keys are always followed by |
Co-authored-by: Hugo van Kemenade <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move the helper functions before the main function? it's easier to read when you're coming from the bottom of the file (and make them private so that someone is not using them by importing json.tool
?)
Co-authored-by: Bénédikt Tran <[email protected]>
Misc/NEWS.d/next/Library/2025-04-05-16-05-34.gh-issue-131952.HX6gCX.rst
Outdated
Show resolved
Hide resolved
json.tool
CLIjson
CLI
Co-authored-by: Adam Turner <[email protected]>
Example:
I'm open to changing the colors. For now it's green for strings, yellow for numbers and cyan for true/false/null.