This commit is contained in:
Marc Beninca 2024-11-25 17:17:05 +01:00
parent ec8d1c113c
commit 25e7cc4f6c
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -21,17 +21,21 @@ _sh_ifs_pop() {
} }
sh_source_check() { sh_source_check() {
local file=".shellcheck.sh" local root="${1}"
local module modules local file module modules
modules="$(sh_source_find "." "${file}")" file="$(mktemp)"
rm --force "${file}" modules="$(sh_source_find "${root}")"
_sh_ifs_new _sh_ifs_new
for module in ${modules}; do for module in ${modules}; do
echo ". \"${module}\"" >>"${file}" echo ". \"${root}/${module}\"" >>"${file}"
done done
_sh_ifs_pop _sh_ifs_pop
shellcheck \ shellcheck \
--check-sourced \ --check-sourced \
--enable "all" \
--exclude "3043" \
--external-sources \
--shell "dash" \
"${file}" "${file}"
rm "${file}" rm "${file}"
} }
@ -76,7 +80,7 @@ main_source_directory() {
_sh_main_log "Not a directory: ${path}" _sh_main_log "Not a directory: ${path}"
return 1 return 1
fi fi
local cmd count ifs module modules local cmd count module modules
modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")" modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")"
_sh_ifs_new _sh_ifs_new
count=0 count=0
@ -111,6 +115,7 @@ main_source_file() {
_sh_main() { _sh_main() {
main_source_file "${ENV}" main_source_file "${ENV}"
main_source_directory "${SH_USER}" main_source_directory "${SH_USER}"
sh_source_check "$(dirname "${ENV}")"
_sh_main_log "" \ _sh_main_log "" \
"sh_… = shell functions" \ "sh_… = shell functions" \
"a__… = aliases" \ "a__… = aliases" \