ifs/new,pop
This commit is contained in:
parent
678cf741c9
commit
ec8d1c113c
1 changed files with 18 additions and 11 deletions
29
sh/main.sh
29
sh/main.sh
|
@ -9,18 +9,27 @@ SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}"
|
|||
|
||||
[ -n "${ENV}" ] || export ENV="${SH_MAIN}"
|
||||
|
||||
sh_source_check() {
|
||||
local file=".shellcheck.sh"
|
||||
local ifs module modules
|
||||
modules="$(sh_source_find "." "${file}")"
|
||||
rm --force "${file}"
|
||||
ifs="${IFS}"
|
||||
_sh_ifs_new() {
|
||||
SH_IFS="${IFS}"
|
||||
IFS="
|
||||
"
|
||||
}
|
||||
|
||||
_sh_ifs_pop() {
|
||||
IFS="${SH_IFS}"
|
||||
unset SH_IFS
|
||||
}
|
||||
|
||||
sh_source_check() {
|
||||
local file=".shellcheck.sh"
|
||||
local module modules
|
||||
modules="$(sh_source_find "." "${file}")"
|
||||
rm --force "${file}"
|
||||
_sh_ifs_new
|
||||
for module in ${modules}; do
|
||||
echo ". \"${module}\"" >>"${file}"
|
||||
done
|
||||
IFS="${ifs}"
|
||||
_sh_ifs_pop
|
||||
shellcheck \
|
||||
--check-sourced \
|
||||
"${file}"
|
||||
|
@ -69,9 +78,7 @@ main_source_directory() {
|
|||
fi
|
||||
local cmd count ifs module modules
|
||||
modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")"
|
||||
ifs="${IFS}"
|
||||
IFS="
|
||||
"
|
||||
_sh_ifs_new
|
||||
count=0
|
||||
_sh_main_log "" \
|
||||
". ${path}"
|
||||
|
@ -88,7 +95,7 @@ main_source_directory() {
|
|||
CMD="${CMD}${cmd}"
|
||||
fi
|
||||
done
|
||||
IFS="${ifs}"
|
||||
_sh_ifs_pop
|
||||
}
|
||||
|
||||
main_source_file() {
|
||||
|
|
Loading…
Reference in a new issue