find/ext,sh

This commit is contained in:
Marc Beninca 2024-11-25 20:46:09 +01:00
parent 13e89092e4
commit ff7f64e670
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 11 additions and 6 deletions

View file

@ -51,7 +51,7 @@ main_source_directory() {
[ -d "${path}" ] || [ -d "${path}" ] ||
return 1 return 1
local cmd count module modules local cmd count module modules
modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")" modules="$(sh_find_sh "${path}" "${SH_MAIN_NAME}")"
_sh_ifs_new _sh_ifs_new
count=0 count=0
_sh_main_log "" \ _sh_main_log "" \
@ -74,12 +74,13 @@ main_source_directory() {
# public # public
sh_source_find() { sh_find_extension() {
local root="${1}" local extension="${1}"
local file="${2}" local root="${2}"
local file="${3}"
set -- \ set -- \
"${root}" \ "${root}" \
-name "*.sh" \ -name "*.${extension}" \
-type "f" -type "f"
[ -n "${file}" ] && [ -n "${file}" ] &&
set -- "${@}" \ set -- "${@}" \
@ -90,6 +91,10 @@ sh_source_find() {
sort sort
} }
sh_find_sh() {
sh_find_extension "sh" "${@}"
}
sh_help() { sh_help() {
sh_log \ sh_log \
"sh_… = shell functions" \ "sh_… = shell functions" \

View file

@ -2,7 +2,7 @@ sh_shellcheck() {
local root="${1}" local root="${1}"
local file module modules local file module modules
file="$(mktemp)" file="$(mktemp)"
modules="$(sh_source_find "${root}")" modules="$(sh_find_sh "${root}")"
_sh_ifs_new _sh_ifs_new
for module in ${modules}; do for module in ${modules}; do
echo ". \"${root}/${module}\"" >>"${file}" echo ". \"${root}/${module}\"" >>"${file}"