commit:     c7e76fc0b9add97eda8cf406cbd168a1997e9ae3
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 14 14:23:07 2023 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue Mar 14 16:54:40 2023 +0000
URL:        https://gitweb.gentoo.org/proj/eselect.git/commit/?id=c7e76fc0

Allow to specify modules by path

* libs/core.bash.in (find_module): Allow to specify an absolute
path as the module's filename.

Bug: https://bugs.gentoo.org/901205
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 ChangeLog         |  5 +++++
 libs/core.bash.in | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index aab936d..57a53fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-03-14  Florian Schmaus  <f...@gentoo.org>
+
+       * libs/core.bash.in (find_module): Allow to specify an absolute
+       path as the module's filename.
+
 2023-02-28  Ulrich Müller  <u...@gentoo.org>
 
        * bin/eselect.in: Disable colours if NO_COLOR is nonempty.

diff --git a/libs/core.bash.in b/libs/core.bash.in
index 740354e..2800cc5 100644
--- a/libs/core.bash.in
+++ b/libs/core.bash.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright (c) 2005-2020 Gentoo Authors
+# Copyright (c) 2005-2023 Gentoo Authors
 #
 # This file is part of the 'eselect' tools framework.
 #
@@ -69,6 +69,15 @@ die() {
 # Find module and echo its filename. Die if module doesn't exist.
 find_module() {
        local modname=$1 modpath
+
+       if [[ ${modname} == */* ]]; then
+               if [[ ${modname} == *.eselect && -f ${modname} ]]; then
+                       echo "${modname}"
+                       return
+               fi
+               die -q "Can't load module ${modname}"
+       fi
+
        for modpath in "${ESELECT_MODULES_PATH[@]}"; do
                if [[ -f ${modpath}/${modname}.eselect ]]; then
                        echo "${modpath}/${modname}.eselect"

Reply via email to