diff options
-rw-r--r-- | sbostuff.sh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sbostuff.sh b/sbostuff.sh index 7de15f5..2c15284 100644 --- a/sbostuff.sh +++ b/sbostuff.sh @@ -59,10 +59,15 @@ _cdsbexp() { /bin/ls -d1 "$@" 2>/dev/null | grep -v /local/ | head -1 } +_set_pkg() { + PKG=${TMP:-/tmp/SBo}/package-"$( basename "$( pwd )" )" +} + cdsb() { # FIXME: get from config file local dir local oldshopt + local ret case "$1" in -h|--help) @@ -88,16 +93,20 @@ EOF if [ -d $SBO_GITROOT/$1 ]; then # category/prgnam (exact) cd $SBO_GITROOT/$1 + _set_pkg elif [ -d "$( _cdsbexp $SBO_GITROOT/*/$1)" ]; then # prgnam without category (exact) cd "$( _cdsbexp $SBO_GITROOT/*/$1)" + _set_pkg else echo "cdsb: no exact match, guessing dir" 1>&2 dir="$( _cdsbexp $SBO_GITROOT/*/$1* )" [ -z "$dir" ] && dir="$( _cdsbexp $SBO_GITROOT/*/*$1* )" if [ -n "$dir" ]; then cd "$dir" - return "$?" + ret="$?" + [ "$ret" = "0" ] && _set_pkg + return "$ret" else echo "cdsb: no match" 1>&2 return 1 |