jsonpp-rs icon indicating copy to clipboard operation
jsonpp-rs copied to clipboard

Add optional color support

Open JeffBelgum opened this issue 6 years ago • 5 comments

Json syntax highlighting would be a great addition to the library. One possibility is highlighting by default when stdout is a tty and no highlighting when stdout is a pipe or file. A --color flag could be used to override default behavior

JeffBelgum avatar Jun 06 '18 19:06 JeffBelgum

good suggestion, I will think about it! I'd also be happy to accept a PR :smile:

flo-l avatar Jun 06 '18 19:06 flo-l

I'd like to work on this if @JeffBelgum doesn't pick it up

BrainMaestro avatar Jun 07 '18 08:06 BrainMaestro

@BrainMaestro sounds good! I suggest you add a color: bool member to PrettyFormatter and handle colors conditionally there. Feel free to open issues if you have any questions!

flo-l avatar Jun 07 '18 08:06 flo-l

@BrainMaestro yeah go for it!

JeffBelgum avatar Jun 07 '18 20:06 JeffBelgum

For people like me who want this but don't care nearly enough to try to implement it, I recommend piping into bat. ./my-program | jsonpp | bat --language=json

rivertam avatar May 02 '19 15:05 rivertam