send() {
afb-client-demo -H -d unix:@afm_platform_rundir@/apis/ws/afm-main "$1" "$2" |
- awk '$1=="ON-REPLY-FAIL"{$1="ERROR:";$2="";print;exit 1;}NR>1'
+ awk '$1=="ON-REPLY" && $3!="success"{$1="ERROR:";$2="";print > "/dev/stderr";exit 1;}NR>1'
+}
+
+getall() {
+ case "$1" in
+ -a|--all) echo -n '{"all":true}';;
+ *) echo -n true;;
+ esac
}
case "$1" in
list|runnables)
- send runnables true
+ send runnables $(getall $2)
;;
add|install)
;;
ps|runners)
- send runners true
+ send runners $(getall $2)
;;
run|start)
send terminate "$i"
;;
- stop|pause)
- i=$2
- send pause "$i"
- ;;
-
- resume|continue)
- i=$2
- send resume "$i"
- ;;
-
state|status)
i=$2
send state "$i"
list
runnables list the runnable widgets installed
+ option -a or --all for all instances
add wgt
install wgt install the wgt file
ps
runners list the running instance
+ option -a or --all for all instances
run id
start id start an instance of the widget of id
kill rid
terminate rid terminate the running instance rid
- stop rid
- pause rid pause the running instance rid
-
- resume rid
- continue rid continue the previously paused rid
-
status rid
state rid get status of the running instance rid