initial commit, handles normal keys and prints full arrays

This commit is contained in:
2022-11-06 14:25:37 -05:00
commit 21dfb20e48
2 changed files with 686 additions and 0 deletions

25
tomcat Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/sh
set -e
# check usage
if ! test -n "$1"; then
printf "Usage: %s [resource...]\n" "$0" 1>&2
exit 64 # sysexits(3) EX_USAGE
fi
if ! test -e "$1"; then
printf "%s: %s: No such file or directory.\n" "$0" "$1" 1>&2
exit 66 # sysexits(3) EX_NOINPUT
fi
TOML=$(sed 's/[^"#]#\+.*//g' <"$1")
set -- $(printf "%s\n" "$2" | cut -d "." --output-delimiter=" " -f 1-)
PAIRS=$(printf "%s\n" "$TOML" | awk "/^\[$1\]/{flag=1; next} /^\[/{flag=0} flag" - )
VAL=$(printf "%s\n" "$PAIRS" | sed -n "s/$2 *= *//p" | tr -d '"[],')
printf "%s\n" "$VAL"
exit 0