main/file

This commit is contained in:
Marc Beninca 2023-05-15 18:41:02 +02:00
parent b170098755
commit 3ffc60e4f1

View file

@ -12,21 +12,22 @@ function main_link_bashrc {
# import modules # import modules
function main_import_modules { function main_import_modules {
local root="${1}" local file="${1}"
if [ -d "${root}" ] ; then if [ -f "${file}" ] ; then
local root="$(dirname "${file}")"
local IFS=$'\n' local IFS=$'\n'
local modules=($(find "${root}" -type 'f' -name '*.sh')) local modules=($(find "${root}" -type 'f' -name '*.sh'))
local module local module
for module in "${modules[@]}" ; do for module in "${modules[@]}" ; do
if [ "${module}" != "${MAIN_BASH_FILE}" ] ; then if [ "${module}" != "${file}" ] ; then
source "${module}" source "${module}"
fi fi
done done
log_trace "${modules[@]}" log_trace "${modules[@]}"
else else
log_fatal "No directory: ${root}" log_fatal "No file: ${file}"
fi fi
} }
# import modules # import modules
main_import_modules "${MAIN_BASH_ROOT}" main_import_modules "${MAIN_BASH_FILE}"