X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=scripts%2Fafm-util;h=bbab51b2452e9929919186b5e0429095ab4e26ca;hb=c0b2c34c3a493ed4ed84586b9bb4a7842a9dc816;hp=eb800d9342a43b1c8884423ee9c8346445643d38;hpb=a1f7f7d2cd79c9391368d0c017452566a5edc44c;p=src%2Fapp-framework-main.git diff --git a/scripts/afm-util b/scripts/afm-util index eb800d9..bbab51b 100755 --- a/scripts/afm-util +++ b/scripts/afm-util @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash if [ "x" = "x${DBUS_SESSION_BUS_ADDRESS}" ]; then DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus" @@ -6,11 +6,19 @@ fi export DBUS_SESSION_BUS_ADDRESS pretty() { - sed \ - -e '/^method return .*/d' \ - -e 's/^Error org.freedesktop.DBus.Error.Failed: "\?\(.*\)"\?$/ERROR: \1/' \ - -e 's/^ string "\(.*\)"/\1/' \ - -e 's/},/&\n/' + sed ' /^method return .*/d + s/^Error org.freedesktop.DBus.Error.Failed: "\?\(.*\)"\?$/ERROR: \1/ + s/^ string "\(.*\)"/\1/ + s:[[{,]:&\n:g + s: *[]}]:\n&:g + ' | + sed ' s:^ *:: + s: *$:: + /[]}],*$/ {x;s:...::;x} + G + /[[{]\n/ {x;s:$: :;x} + s:^\(.*[^\n]\)\n\( *\)$:\2\1: + ' } send() { @@ -20,6 +28,7 @@ send() { org.AGL.afm.user.$1 \ "string:$2" | pretty + return ${PIPESTATUS[0]} } case "$1" in @@ -52,6 +61,11 @@ case "$1" in send start "\"$i\"" ;; + run-remote|start-remote) + i=$2 + send start '{"id":"'"$i"'","mode":"remote"}' + ;; + once) i=$2 send once "\"$i\""