[Libreoffice-commits] dev-tools.git: prettyprint/prettyprint

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri May 7 07:09:02 UTC 2021


 prettyprint/prettyprint |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 5e72499b6cdc3527db7e2facdc1903a2c7f6b4e5
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri May 7 09:08:44 2021 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri May 7 09:08:44 2021 +0200

    prettyprint: add json pretty-printer
    
    Useful when inspecting compile_commands.json in core.git e.g.
    
    Change-Id: I8eb3bd8184f53d3289720621f64d504216f4e916

diff --git a/prettyprint/prettyprint b/prettyprint/prettyprint
index b643d57..c36c957 100755
--- a/prettyprint/prettyprint
+++ b/prettyprint/prettyprint
@@ -12,6 +12,9 @@ if [ "$kind" == "text/rtf" ]; then
 elif [ "$kind" == "application/xml" -o "$kind" == "image/svg+xml" -o "$kind" == "text/xml" ]; then
 	#xmllint --format --recover $file 2>/dev/null
 	$mydir/formatxml $file
+elif [ "$1" == "json" ]; then
+	# file(1) sets $kind to text/plain for me, allow forcing it via a parameter
+	cat $file | python3 -mjson.tool
 else
 	echo "unknown type: $kind"
 fi


More information about the Libreoffice-commits mailing list