main/find
This commit is contained in:
parent
048f41cd05
commit
222972b6df
3 changed files with 8 additions and 14 deletions
|
@ -2,7 +2,7 @@ rwx_shellcheck() {
|
|||
local root="${1}"
|
||||
local file module modules path
|
||||
file="$(mktemp)"
|
||||
modules="$(rwx_find_shell "${root}")"
|
||||
modules="$(rwx_main_find "${root}")"
|
||||
while IFS= read -r module; do
|
||||
path="${root}/${module}"
|
||||
echo ". \"${path}\"" >>"${file}"
|
||||
|
|
18
sh/main.sh
18
sh/main.sh
|
@ -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}"
|
||||
|
|
|
@ -14,7 +14,7 @@ rwx_self_subset() {
|
|||
file="${argument}.sh"
|
||||
if [ -d "${root}" ]; then
|
||||
local file
|
||||
for file in $(rwx_find_shell "${root}"); do
|
||||
for file in $(rwx_main_find "${root}"); do
|
||||
echo "${argument}/${file}"
|
||||
done
|
||||
elif [ -f "${RWX_ROOT_SYSTEM}/${file}" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue