I’m writing an elixir script that output JSON files on STDOUT, I’d like to offer syntax colorization, like the one of python project HTTPie which use Pygmentslibrary.
Do you know if there’s an elixir or erlang equivalent? If not, have you advices to built it?
I didn’t know jq, thank you it will be useful on a day2day basis. My output won’t be 100% JSON, so piping to jq is not an option. Since it’s pure C, I’ll check if I’m able to create elixir bindings for jq…
If you have something to colourize, perhaps makeup can help you.
You’ll need to write a parser for your format though, as well as a formatter for the terminal, but at least the latter can be put under open source or even get integrated into makeup, as colouring into a terminal is something I love pygmeents for.
There is IO.ANSI in the stdlib. The tricky part about colorization is knowing when not to do it. If you are writing a unix CLI tool, colorizing the output always makes it difficult to pipe the output of that tool into another tool. IO.ANSI mostly gets this correct