From db1b5e010dfcb120b0e7f685ccefbcb311ed230e Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 23 May 2019 15:48:06 -0300 Subject: Pretty printing aliases for JSON --- aliases.dot.link | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aliases.dot.link b/aliases.dot.link index 54717a7..d660066 100644 --- a/aliases.dot.link +++ b/aliases.dot.link @@ -59,3 +59,17 @@ alias s="shell" alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg" alias dpkg-source='HOME=~/code/debian/keyring dpkg-source' alias dget='HOME=~/code/debian/keyring dget' + +# JSON +# See https://stackoverflow.com/questions/352098/how-can-i-pretty-print-json-in-a-shell-script#1920585 +prettyjson_string() { + echo "$1" | python -m json.tool +} + +prettyjson_file() { + python -m json.tool "$1" +} + +prettyjson_url() { + curl "$1" | python -m json.tool +} -- cgit v1.2.3