j: Allow additional subdirs to be specified
This allows us to use j in an even more flexible way: specify a target with a
path. Ie: "j packages/mendel-minimal" takes you to
$ROOTDIR/packages/mendel-minimal.
Change-Id: Iaf5ae1b6b76d29886eb577068c9ab314903fa8d3
diff --git a/setup.sh b/setup.sh
index 6bfd79a..8dcc2c3 100755
--- a/setup.sh
+++ b/setup.sh
@@ -64,11 +64,6 @@
echo "${groups}" | grep -qe '.*internal.*'
}
-function compile-changelogs
-{
- find "${ROOTDIR}/packages" -name changelog | compile_changelogs.py
-}
-
function mdt
{
PYTHONPATH="${PYTHONPATH}:${ROOTDIR}/tools/mdt" /usr/bin/python3 "${ROOTDIR}/tools/mdt/mdt/main.py" "$@"
@@ -116,6 +111,8 @@
function j
{
local target="$1"; shift
+ local splitpath=(${target//\// })
+ local subpath=""
if [[ -z "${target}" ]]; then
cd "${ROOTDIR}"
@@ -123,12 +120,21 @@
fi
if [[ -z "${JUMP_TARGETS[$target]}" ]]; then
+ target="${splitpath[0]}"
+ subpath="${splitpath[@]:1}"
+ fi
+
+ if [[ -z "${JUMP_TARGETS[$target]}" ]]; then
echo "Jump targets are:"
echo "${!JUMP_TARGETS[@]}"
return 1
fi
cd "${JUMP_TARGETS[$target]}"
+
+ if [[ ! -z "${subpath}" ]]; then
+ cd "${subpath}"
+ fi
}
if builtin complete >/dev/null 2>/dev/null; then