File indexing completed on 2024-04-21 04:41:39
0001 #!/bin/sh 0002 # 0003 # SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org> 0004 # SPDX-License-Identifier: CC0-1.0 0005 # 0006 # Makes network repsonses in the log folder easier to read by formatting and unpacking them 0007 # 0008 0009 if [ -z "$KPUBLICTRANSPORT_LOG_DIR" ]; then 0010 echo "$KPUBLICTRANSPORT_LOG_DIR not set" 0011 exit 1 0012 fi 0013 0014 if ! [ -z "`which jq`" ]; then 0015 for i in `find $KPUBLICTRANSPORT_LOG_DIR -name "*.json"`; do 0016 jq '.' $i > $i.pretty 0017 if ! [ "$?" == 0 ]; then 0018 echo "parse error in $i" 0019 rm $i.pretty 0020 else 0021 mv $i.pretty $i 0022 fi 0023 done 0024 else 0025 echo "Skipping JSON prettification, jq not found"; 0026 fi 0027 0028 if ! [ -z "`which xmllint`" ]; then 0029 for i in `find $KPUBLICTRANSPORT_LOG_DIR -name "*.xml"`; do 0030 xmllint --format $i > $i.pretty 0031 if ! [ "$?" == 0 ]; then 0032 echo "parse error in $i" 0033 rm $i.pretty 0034 else 0035 mv $i.pretty $i 0036 fi 0037 done 0038 else 0039 echo "Skipping XML prettification, xmllint not found"; 0040 fi 0041 0042 if ! [ -z "`which gunzip`" ]; then 0043 for i in `find $KPUBLICTRANSPORT_LOG_DIR -name "*.gz"`; do 0044 gunzip $i 0045 done 0046 else 0047 echo "Skipping GZip unpacking, gzip not found"; 0048 fi