This commit is contained in:
Marc Beninca 2024-11-25 16:31:59 +01:00
parent 62b8f60841
commit 678cf741c9
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -63,33 +63,32 @@ _sh_main_log() {
main_source_directory() {
local path="${1}"
if [ -d "${path}" ]; then
local cmd count ifs module modules
modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")"
ifs="${IFS}"
IFS="
"
count=0
_sh_main_log "" \
". ${path}"
for module in ${modules}; do
count=$((count + 1))
_sh_main_log "$(printf "%02d" "${count}") ${module%.sh}"
module="${path}/${module}"
# shellcheck disable=SC1090
. "${module}"
cmd="$(_sh_main_commands "${module}")"
if [ -n "${cmd}" ]; then
[ -n "${CMD}" ] && CMD="${CMD}
"
CMD="${CMD}${cmd}"
fi
done
IFS="${ifs}"
else
if [ ! -d "${path}" ]; then
_sh_main_log "Not a directory: ${path}"
return 1
fi
local cmd count ifs module modules
modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")"
ifs="${IFS}"
IFS="
"
count=0
_sh_main_log "" \
". ${path}"
for module in ${modules}; do
count=$((count + 1))
_sh_main_log "$(printf "%02d" "${count}") ${module%.sh}"
module="${path}/${module}"
# shellcheck disable=SC1090
. "${module}"
cmd="$(_sh_main_commands "${module}")"
if [ -n "${cmd}" ]; then
[ -n "${CMD}" ] && CMD="${CMD}
"
CMD="${CMD}${cmd}"
fi
done
IFS="${ifs}"
}
main_source_file() {