aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Bynens <mathias@qiwi.be>2012-01-02 22:50:59 +0100
committerMathias Bynens <mathias@qiwi.be>2012-01-02 22:50:59 +0100
commit307c4257f2b627de8bb5e829c3ab9b1a4039c7f1 (patch)
treef43ed0d57372c701096adf432f05864c992d4d69
parentf62dfea69705ce734d0d8cc8af6c072a0b06fffb (diff)
downloaddotfiles-307c4257f2b627de8bb5e829c3ab9b1a4039c7f1.tar.gz
dotfiles-307c4257f2b627de8bb5e829c3ab9b1a4039c7f1.tar.bz2
dotfiles-307c4257f2b627de8bb5e829c3ab9b1a4039c7f1.zip
Better `json` function
Ref. 9b0af44766d2a2cc61ae0142ac3ec9f0bed75674
-rw-r--r--[-rwxr-xr-x].bash_profile0
-rw-r--r--.functions4
2 files changed, 1 insertions, 3 deletions
diff --git a/.bash_profile b/.bash_profile
index 7b15a81..7b15a81 100755..100644
--- a/.bash_profile
+++ b/.bash_profile
diff --git a/.functions b/.functions
index 833f5e6..0ae79c9 100644
--- a/.functions
+++ b/.functions
@@ -21,9 +21,7 @@ function httpcompression() {
function json() {
if [ -p /dev/stdin ]; then
# piping, e.g. `echo '{"foo":42}' | json`
- while read data; do
- python -mjson.tool <<< "$data" | pygmentize -l javascript
- done
+ python -mjson.tool | pygmentize -l javascript
else
# e.g. `json '{"foo":42}'`
python -mjson.tool <<< "$*" | pygmentize -l javascript