Re:PJSON: pretty, colorful json output formatting for terminal
by geofft on Tuesday September 18, 2012 @08:11PM
(#4541306)
If this is based on pygments, is it reasonable to have a command like this that works on everything pygments knows how to highlight, and plugs into a bunch of pretty-printers / reformatters, e.g. GNU indent?
Is there an equivalent of pygments for pretty-printing all the things?
Re:PJSON: pretty, colorful json output formatting for terminal
by Anm on Tuesday September 18, 2012 @10:31PM
(#4541717)
"Small retina display images are fucking huge."
Even when reshown on retina displays, since the HTML standard is to attend to the pixel size and not the physical resolution. Screenshots taken with the standard Cmd-Shift-4 or similar all include proper resolution metadata, should someone want to show it at the correct size.
Is there an equivalent of pygments for pretty-printing all the things?
☁ U+2601 CLOUD
⚡ U+26A1 HIGH VOLTAGE SIGN
It's from my zsh theme: https://raw.github.com/igorgue/oh-my-zsh/master/themes/igorg... I stole it from the cloud theme and another theme that I don't remember.
The thunder lights up when the program doesn't end property (return 0).
[1] <3 thunder http://wiki.xkcd.com/irc/Heart_Thunder
Inspired! Did you come up with that part?
This is the code add it at the end of your prompt:
http://unicodesnowmanforyou.com/
https://github.com/robbyrussell/oh-my-zsh/wiki/themes
https://github.com/ddopson/underscore-cli
Rather than pipe curl's output through stuff though, for the most part I use httpie [1]. It's a human-friendly curl wrapper.
[1] https://github.com/jkbr/httpie
EDIT: I love seeing something that does an "awesome-print" with terminal colorization, though.
Even when reshown on retina displays, since the HTML standard is to attend to the pixel size and not the physical resolution. Screenshots taken with the standard Cmd-Shift-4 or similar all include proper resolution metadata, should someone want to show it at the correct size.
alias pjson='pygmentize -l json'
If you're passing it the file name, pygmentize will figure out the lexer to use, e.g.
pygmentize foo.json
pygmentize bar.rb
It's only when you have it read from stdin that you need to specify, e.g.
pygmentize -l json < foo.json
python -m json.tool "$@" | pygmentize -l json | less -RSNFX
$ gem install jazor coderay
$ echo '{"foo": "bar"}' | jazor | coderay -json