From d93f64e5f4a4f30755eabcef8db58ae4611d914a Mon Sep 17 00:00:00 2001 From: TheK4n Date: Sat, 8 Oct 2022 11:33:38 +0300 Subject: [PATCH] returned func json as json prettifier without syntax highlight --- sub/bash/functions | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sub/bash/functions b/sub/bash/functions index d4c2d3b..c8ec319 100644 --- a/sub/bash/functions +++ b/sub/bash/functions @@ -222,3 +222,12 @@ rayso() { echo "https://ray.so/?colors=candy&background=true&darkMode=true&padding=64&title=${TITLE}&code=${CODE}&language=auto" } +# json prettyfier +json() { + if [ -t 0 ]; then # argument + python -m json.tool <<< "$*" + else # pipe + python -m json.tool + fi +} +