aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2019-05-23 15:48:06 -0300
committerSilvio Rhatto <rhatto@riseup.net>2019-05-23 15:48:06 -0300
commitdb1b5e010dfcb120b0e7f685ccefbcb311ed230e (patch)
tree9bb00b0b5dba2500ecdc9ee3a2b097babbfb5273
parent08940e38cb120c39330060c2bd146b00b72a1c9b (diff)
downloadprofile-db1b5e010dfcb120b0e7f685ccefbcb311ed230e.tar.gz
profile-db1b5e010dfcb120b0e7f685ccefbcb311ed230e.tar.bz2
Pretty printing aliases for JSON
-rw-r--r--aliases.dot.link14
1 files changed, 14 insertions, 0 deletions
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
+}