Color output of keys and values like jq
See original GitHub issueAwesome project! I’m dealing now with a lot of yml files to be processed in kubernetes…
Is there a way to parse and print the key values in color?
Maybe just the same colors as jq
or like in the vim editor?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:20
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Bonus: Coloring JQ's raw output - API Handyman
What we want to do now is coloring raw terminal output, ... a map with user-friendly color names as keys and ugly color...
Read more >jq Manual (development version)
This can be useful when the values being output can contain newlines. ... This syntax only works for simple, identifier-like keys, that is,...
Read more >jq Cheat Sheet - LZone
Output Formatting · jq Extraction Examples · “Deep” Value Extraction · Accessing unknown keys · Changing values with jq · Delete values with...
Read more >JQ does not contain for "key": "value" JSON structure
The above filter gives the following output: { "name": "banana", "tags": [ { "id": ... If you want to exclude 'colored', use contains()...
Read more >jq: colorize selected field of json file [closed]
If this is about how jq colorizes the output, have a look at man jq : ... like imitating the way jq colors...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it’s still worth doing as part of yq itself, many people use
cat a.json | jq .
to preview highlighted and prettified json, it is so tempting to usecat b.yaml | yq -y .
to achieve the same for yaml files.It’s okay if pygments is not ideal, just redirect people to their repo in case someone wants to report an issue.
You can
pip install pygments
and pipe the output of yq topygmentize -l yaml
to highlight in the terminal. Unfortunately the Pygments yaml highlighter is very drab and does not highlight much. https://bitbucket.org/birkenfeld/pygments-main/issues?q=yaml