This commit is contained in:
Marc Beninca 2024-11-13 14:55:20 +01:00
parent 216fe057c9
commit 8982496082
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -16,18 +16,21 @@ main_link_bashrc() {
main_import_modules() { main_import_modules() {
local file="${1}" local file="${1}"
if [ -f "${file}" ]; then if [ -f "${file}" ]; then
local ifs module modules path root local count ifs module modules path root
path="$(realpath --canonicalize-existing "${file}")" path="$(realpath --canonicalize-existing "${file}")"
root="$(dirname "${path}")" root="$(dirname "${path}")"
echo
echo "${root}"
modules="$(find "${root}" -type "f" -name "*.sh" -printf "%P modules="$(find "${root}" -type "f" -name "*.sh" -printf "%P
" | sort)" " | sort)"
ifs="${IFS}" ifs="${IFS}"
IFS=" IFS="
" "
count=0
echo
echo "${root}"
for module in ${modules}; do for module in ${modules}; do
echo "${module%.sh}" count=$((count + 1))
printf "%02d" "${count}"
echo " ${module%.sh}"
module="${root}/${module}" module="${root}/${module}"
if [ "${module}" != "${path}" ]; then if [ "${module}" != "${path}" ]; then
. "${module}" . "${module}"