find with extension
This commit is contained in:
parent
9e3c268b1c
commit
52593c9571
4 changed files with 5 additions and 7 deletions
|
@ -289,10 +289,10 @@ rwx_code_main() {
|
|||
# find user modules
|
||||
rwx_code_modules_user="$(rwx_main_find "${rwx_code_root}")"
|
||||
# source user modules
|
||||
[ "${rwx_code_modules_user}" ] &&
|
||||
[ -n "${rwx_code_modules_user}" ] &&
|
||||
while IFS= read -r module; do
|
||||
# shellcheck disable=SC1090
|
||||
. "${rwx_code_root}/${module}.${RWX_MAIN_EXTENSION}"
|
||||
. "${rwx_code_root}/${module}"
|
||||
done <<EOF
|
||||
${rwx_code_modules_user}
|
||||
EOF
|
||||
|
|
|
@ -4,7 +4,7 @@ rwx_shellcheck() {
|
|||
file="$(mktemp)"
|
||||
modules="$(rwx_main_find "${root}")"
|
||||
while IFS= read -r module; do
|
||||
path="${root}/${module}.${RWX_MAIN_EXTENSION}"
|
||||
path="${root}/${module}"
|
||||
echo ". \"${path}\"" >>"${file}"
|
||||
done <<EOF
|
||||
${modules}
|
||||
|
|
|
@ -35,7 +35,6 @@ rwx_main_path="${rwx_main_root}/${rwx_main_file}"
|
|||
# FIXME separate in two functions
|
||||
# find root directory shell modules
|
||||
#| find
|
||||
#| sed
|
||||
#| sort
|
||||
rwx_main_find() {
|
||||
local root="${1}"
|
||||
|
@ -45,7 +44,6 @@ rwx_main_find() {
|
|||
-name "*.${RWX_MAIN_EXTENSION}" \
|
||||
-type "f" \
|
||||
-printf "%P\n" |
|
||||
sed "s|\\.[^.]*\$||" |
|
||||
sort
|
||||
}
|
||||
|
||||
|
@ -66,7 +64,7 @@ rwx_main_main() {
|
|||
# except currently running main module
|
||||
if [ "${module}" != "${RWX_MAIN_MODULE}" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
. "${rwx_main_root}/${module}.${RWX_MAIN_EXTENSION}"
|
||||
. "${rwx_main_root}/${module}"
|
||||
fi
|
||||
done <<EOF
|
||||
${modules}
|
||||
|
|
|
@ -15,7 +15,7 @@ rwx_self_subset() {
|
|||
if [ -d "${root}" ]; then
|
||||
local file
|
||||
for file in $(rwx_main_find "${root}"); do
|
||||
echo "${argument}/${file}.${RWX_MAIN_EXTENSION}"
|
||||
echo "${argument}/${file}"
|
||||
done
|
||||
elif [ -f "${rwx_main_root}/${file}" ]; then
|
||||
echo "${file}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue