redraw_fixer: fix a couple of unneeded extra redundant stuff
[staging/windowmanager.git] / scripts / wm-request
index c98e748..b9a703a 100755 (executable)
@@ -13,7 +13,19 @@ then
    exit 1
 fi
 
-for i in uuidgen curl
+UUIDFILE=/tmp/wm-request-uuid
+if ! which uuidgen 2>/dev/null 1>&2
+then
+   echo "c7c638c5-d097-4eb4-9012-a1e4c25b9808" > $UUIDFILE
+else
+   if ! [ -f $UUIDFILE ]
+   then
+      uuidgen > $UUIDFILE
+   fi
+fi
+UUID="`cat $UUIDFILE`"
+
+for i in afb-client-demo
 do
    which $i 2>/dev/null 1>&2 || { echo "Program $i is missing" >&2; exit 1; }
 done
@@ -41,24 +53,15 @@ fi
 verb=$1
 shift
 
-args=""
-for i in "$@"
-do
-   args="$i"
-done
-
-if [ "$args" ]
-then
-   args="?$args"
-fi
-
-UUIDFILE=/tmp/wm-request-uuid
-if ! [ -f $UUIDFILE ]
+set +u
+args=
+if [ "$1" ]
 then
-   uuidgen > $UUIDFILE
+   set -u
+   args='{"drawing_name":"'"$1"'"}'
+   shift
 fi
-UUID="`cat $UUIDFILE`"
 
-curl -H "x-afb-uuid: $UUID" -s http://localhost:1234/api/winman/${verb}${args} | json_pretty
+afb-client-demo -H ws://localhost:1700/api\?token=wm\&uuid=$UUID winman $verb $args
 
 # vim:set ft=sh: