aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2022-04-20 11:45:54 -0400
committerB. Watson <yalhcru@gmail.com>2022-04-20 11:45:54 -0400
commit07e9be3081bbc86c01eabf8c7a175cf70ba94eae (patch)
treea6ac5d9fb6cea608a26b88a5369dfd49ada946c0
parentb7babc81e83be2ec46f44504c0f3ae85dbb51132 (diff)
downloadsbostuff-07e9be3081bbc86c01eabf8c7a175cf70ba94eae.tar.gz
set PKG in cdsb()
-rw-r--r--sbostuff.sh11
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