aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/afm-util
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-03-15 09:57:03 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-03-15 09:57:03 +0100
commite96fa2cd6b81784ad6fb6ba1794ac6e034486b97 (patch)
treefa5e0c658bdb0d5e01983a368c661c2a971c0b70 /scripts/afm-util
parent53d2c7bab0afcb08df649cd8ca8ed719e1c8f743 (diff)
afm-util: install and pretty printing
Change-Id: I00cadda36c71495c352cfee9bfd4540f5defc89e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'scripts/afm-util')
-rwxr-xr-xscripts/afm-util23
1 files changed, 18 insertions, 5 deletions
diff --git a/scripts/afm-util b/scripts/afm-util
index f5da0e1..cc7ab55 100755
--- a/scripts/afm-util
+++ b/scripts/afm-util
@@ -4,8 +4,21 @@ if [ "x" = "x${DBUS_SESSION_BUS_ADDRESS}" ]; then
DBUS_SESSION_BUS_ADDRESS:=unix:path=/run/user/$UID/bus
fi
+pretty() {
+ sed \
+ -e '/^method return .*/d' \
+ -e 's/^Error org.freedesktop.DBus.Error.Failed: "\?\(.*\)"\?$/ERROR: \1/' \
+ -e 's/^ string "\(.*\)"/\1/' \
+ -e 's/},/&\n/'
+}
+
send() {
- dbus-send --session --dest=org.AGL.afm.user --print-reply /org/AGL/afm/user org.AGL.afm.user.$1 "string:$2"
+ dbus-send --session --print-reply \
+ --dest=org.AGL.afm.user \
+ /org/AGL/afm/user \
+ org.AGL.afm.user.$1 \
+ "string:$2" |
+ pretty
}
case "$1" in
@@ -82,8 +95,8 @@ The commands are:
run id
start id start an instance of the widget of id
- terminate rid
- kill rid terminate the running instance rid
+ kill rid
+ terminate rid terminate the running instance rid
stop rid
pause rid stop the running instance rid
@@ -91,8 +104,8 @@ The commands are:
resume rid
continue rid continue the previously rid
- state rid
- status rid get status of the running instance rid
+ status rid
+ state rid get status of the running instance rid
EOC
;;