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

View file

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