From c6c20ee825759a662a6a0adf37ff958ec4cb5ef3 Mon Sep 17 00:00:00 2001 From: Alois Mahdal Date: Sep 21 2018 00:21:43 +0000 Subject: Add property reading utility functtions --- diff --git a/src/shellfu/bmo_be.sh b/src/shellfu/bmo_be.sh index 11c57b3..1d6c94f 100644 --- a/src/shellfu/bmo_be.sh +++ b/src/shellfu/bmo_be.sh @@ -18,6 +18,21 @@ bmo_be__a2s() { saturnin__conf -j -1 "be.def.axis.$axis.sigil" } +bmo_be__aprop() { + # + # Print property $2 of axis $1 + # + # Usage: + # bmo_be__aprop AXIS PROP + # + local axis=$1 + local prop=$2 + test -n "$axis" || { __bmo_be__ue "no AXIS?"; return 2; } + test -n "$prop" || { __bmo_be__ue "no PROP?"; return 2; } + debug -v axis prop + saturnin__conf -j -1 "be.def.axis.$axis.$prop" +} + bmo_be__isa_axis() { # # True if $1 is an axis @@ -164,6 +179,23 @@ bmo_be__s2a() { return 1 } +bmo_be__sprop() { + # + # Print property $3 of spot $2 on axis $1 + # + # Usage: + # bmo_be__sprop AXIS SPOT PROP + # + local axis=$1 + local spot=$2 + local prop=$3 + test -n "$axis" || { __bmo_be__ue "no AXIS?"; return 2; } + test -n "$spot" || { __bmo_be__ue "no SPOT?"; return 2; } + test -n "$prop" || { __bmo_be__ue "no PROP?"; return 2; } + debug -v axis spot prop + saturnin__conf -j -1 "be.def.spot.$axis:$spot.$prop" +} + bmo_be__state() { # # Show state of axis $1 @@ -352,6 +384,7 @@ __bmo_be__ue() { warn "bad usage: $parent(): $msg" case $parent in bmo_be__a2s) patts=("AXIS") ;; + bmo_be__aprop) patts=("AXIS PROP") ;; bmo_be__move) patts=("AXIS SPOT") ;; bmo_be__leave) patts=("AXIS") ;; bmo_be__isa_axis) patts=("THING") ;; @@ -359,6 +392,7 @@ __bmo_be__ue() { bmo_be__lsaxes) patts=() ;; bmo_be__lsspots) patts=("[AXIS]") ;; bmo_be__s2a) patts=("SIGIL") ;; + bmo_be__sprop) patts=("AXIS SPOT PROP") ;; bmo_be__state) patts=("AXIS") ;; esac for patt in "${patts[@]}"; do