From 8724b4279c374ef6b8490323a28f4570f024473d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 31 May 2022 11:56:03 +0200 Subject: Add tmcli, very simple CLI tool --- extra/tmcli | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 extra/tmcli 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 + + -- cgit v1.2.3-55-g7522