main/find

This commit is contained in:
Marc Beninca 2025-07-09 01:04:59 +02:00
parent 048f41cd05
commit 222972b6df
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
3 changed files with 8 additions and 14 deletions

View file

@ -28,16 +28,15 @@ RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}"
# │ main │ find │
# ╰──────┴──────╯
# find directory’s files by extension
# find directory’s shell files
#| find
#| sort
rwx_find_extension() {
local extension="${1}"
local root="${2}"
local file="${3}"
rwx_main_find() {
local root="${1}"
local file="${2}"
set -- \
"${root}" \
-name "*.${extension}" \
-name "*.sh" \
-type "f"
[ -n "${file}" ] &&
set -- "${@}" \
@ -48,11 +47,6 @@ rwx_find_extension() {
sort
}
# find directory’s sh files
rwx_find_shell() {
rwx_find_extension "sh" "${@}"
}
# ╭──────┬───────╮
# │ main │ shell │
# ╰──────┴───────╯
@ -93,7 +87,7 @@ rwx_main_source() {
count=0
_rwx_main_log "" \
". ${root}"
modules="$(rwx_find_shell "${root}" "${file}")"
modules="$(rwx_main_find "${root}" "${file}")"
while IFS= read -r module; do
count=$((count + 1))
_rwx_main_log "$(printf "%02d" "${count}") ${module%.sh}"