diff options
Diffstat (limited to 'extra/tmcli')
-rwxr-xr-x | extra/tmcli | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/extra/tmcli b/extra/tmcli new file mode 100755 index 0000000..981e0b1 --- /dev/null +++ b/extra/tmcli @@ -0,0 +1,25 @@ +#!/bin/sh + +if [ "$1" = "status" ]; then + shift + while [ $# -gt 0 ]; do + printf "%s" "bla, status, $1" | socat -T1 - udp-datagram:127.0.0.1:9915 | cut -c 5- + shift + done +elif [ "$1" = "exec" ]; then + name="$2" + shift 2 + jq='{}' + while [ $# -gt 1 ]; do + jq=$( printf "%s" "$jq" | jq --arg key "${1#--}" --arg val "$2" '. += { ($key): $val }' ) + shift 2 + done + echo "Sending:" + echo "$jq" + printf "%s" "bla, $name, $jq" | socat -T1 - udp-datagram:127.0.0.1:9915 | cut -c 5- +else + echo "unknown command, try status or exec" + exit 1 +fi + + |