diff --git a/script/prettyprint-log b/script/prettyprint-log new file mode 100755 index 000000000..16c6e4fda --- /dev/null +++ b/script/prettyprint-log @@ -0,0 +1,78 @@ +#!/bin/bash + +# Script to pretty print the output of the github-mcp-server +# log. +# +# It uses colored output when running on a terminal. + +# show script help +show_help() { + cat <&2 + exit 1 + fi + input="$1" +else + input="/dev/stdin" +fi + +# check if we are in a terminal for showing colors +if test -t 1; then + is_terminal="1" +else + is_terminal="0" +fi + +# Processs each log line, print whether is stdin or stdout, using different +# colors if we output to a terminal, and pretty print json data using jq +sed -nE 's/^.*\[(stdin|stdout)\]:.* ([0-9]+) bytes: (.*)\\n"$/\1 \2 \3/p' $input | +while read -r io bytes json; do + # Unescape the JSON string safely + unescaped=$(echo "$json" | awk '{ print "echo -e \"" $0 "\" | jq ." }' | bash) + echo "$(color $io)($bytes bytes):$(reset)" + echo "$unescaped" | jq . + echo +done pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy