shellcheck
This commit is contained in:
parent
839c8fa069
commit
0e8cab41f6
2 changed files with 25 additions and 22 deletions
28
sh/main.sh
28
sh/main.sh
|
@ -38,27 +38,7 @@ _sh_main_log() {
|
|||
esac
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
sh_source_check() {
|
||||
local root="${1}"
|
||||
local file module modules
|
||||
file="$(mktemp)"
|
||||
modules="$(sh_source_find "${root}")"
|
||||
_sh_ifs_new
|
||||
for module in ${modules}; do
|
||||
echo ". \"${root}/${module}\"" >>"${file}"
|
||||
done
|
||||
_sh_ifs_pop
|
||||
shellcheck \
|
||||
--check-sourced \
|
||||
--enable "all" \
|
||||
--exclude "3043" \
|
||||
--external-sources \
|
||||
--shell "dash" \
|
||||
"${file}"
|
||||
rm "${file}"
|
||||
}
|
||||
# sort
|
||||
|
||||
sh_source_find() {
|
||||
local root="${1}"
|
||||
|
@ -120,6 +100,8 @@ main_source_file() {
|
|||
fi
|
||||
}
|
||||
|
||||
# public
|
||||
|
||||
sh_help() {
|
||||
sh_log \
|
||||
"sh_… = shell functions" \
|
||||
|
@ -131,9 +113,11 @@ sh_main() {
|
|||
main_source_file "${ENV}"
|
||||
main_source_directory "${SH_USER}"
|
||||
sh_log
|
||||
sh_source_check "$(dirname "${ENV}")"
|
||||
sh_shellcheck "$(dirname "${ENV}")"
|
||||
sh_log
|
||||
sh_help
|
||||
}
|
||||
|
||||
# main
|
||||
|
||||
sh_main
|
||||
|
|
19
sh/shellcheck.sh
Normal file
19
sh/shellcheck.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
sh_shellcheck() {
|
||||
local root="${1}"
|
||||
local file module modules
|
||||
file="$(mktemp)"
|
||||
modules="$(sh_source_find "${root}")"
|
||||
_sh_ifs_new
|
||||
for module in ${modules}; do
|
||||
echo ". \"${root}/${module}\"" >>"${file}"
|
||||
done
|
||||
_sh_ifs_pop
|
||||
shellcheck \
|
||||
--check-sourced \
|
||||
--enable "all" \
|
||||
--exclude "3043" \
|
||||
--external-sources \
|
||||
--shell "dash" \
|
||||
"${file}"
|
||||
rm "${file}"
|
||||
}
|
Loading…
Reference in a new issue