allow soucing using full path specifier

This commit is contained in:
fabolous005 2024-10-05 16:53:52 +02:00
parent 76853d4d89
commit 16e086739d

9
etools
View File

@ -4,7 +4,13 @@
# NOTE: parse config, gets run when sourced # NOTE: parse config, gets run when sourced
function etools_configure() { function etools_configure() {
ETOOLS_DIR="$PWD/$(dirname "${BASH_SOURCE[0]}")" local location=
location=$(dirname "${BASH_SOURCE[0]}")
if [[ "$location" == /* ]]; then
ETOOLS_DIR=$location
else
ETOOLS_DIR="$PWD/$location"
fi
. "$ETOOLS_DIR"/config.sh . "$ETOOLS_DIR"/config.sh
_configure _configure
"$ETOOLS_DIR"/config.sh "$ETOOLS_DIR"/config.sh
@ -44,6 +50,7 @@ function etools_smart_find() {
# NOTE: get latest enabled version for a given package name # NOTE: get latest enabled version for a given package name
function etools_get_version() { function etools_get_version() {
[ -z "$1" ] && eerror "Pass a package name to this function" "\n" && return 2; [ -z "$1" ] && eerror "Pass a package name to this function" "\n" && return 2;
# WARN: turns out ir doesn't
# in this case globs work with -d # in this case globs work with -d
# shellcheck disable=SC2144 # shellcheck disable=SC2144
[ ! -d "${ETOOLS_REPO_PATH}"/*/"$1" ] && \ [ ! -d "${ETOOLS_REPO_PATH}"/*/"$1" ] && \