diff options
author | Simon Rettberg | 2022-05-31 11:56:03 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-05-31 11:56:03 +0200 |
commit | 8724b4279c374ef6b8490323a28f4570f024473d (patch) | |
tree | 39cee24582af72f91b105a5538d3e39ced0d03c0 | |
parent | pom: maven-assembly-plugin must not be versioned (diff) | |
download | taskman-lite-8724b4279c374ef6b8490323a28f4570f024473d.tar.gz taskman-lite-8724b4279c374ef6b8490323a28f4570f024473d.tar.xz taskman-lite-8724b4279c374ef6b8490323a28f4570f024473d.zip |
Add tmcli, very simple CLI tool
-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 + + |