This commit is contained in:
parent
289ee65a98
commit
7a8915682d
1 changed files with 13 additions and 10 deletions
23
sh/main.sh
23
sh/main.sh
|
@ -7,27 +7,27 @@
|
||||||
# │ main │ constants │
|
# │ main │ constants │
|
||||||
# ╰──────┴───────────╯
|
# ╰──────┴───────────╯
|
||||||
|
|
||||||
# parent directory for the project
|
# project parent directory
|
||||||
RWX_MAIN_PARENT="/usr/local/lib"
|
RWX_MAIN_PARENT="/usr/local/lib"
|
||||||
# name of the project itself
|
# project name
|
||||||
RWX_MAIN_NAME="rwx"
|
RWX_MAIN_NAME="rwx"
|
||||||
# name of the entrypoint module
|
# project entrypoint module
|
||||||
RWX_MAIN_MODULE="main"
|
RWX_MAIN_MODULE="main"
|
||||||
# extension of shell modules
|
# shell modules extension
|
||||||
RWX_MAIN_EXTENSION="sh"
|
RWX_MAIN_EXTENSION="sh"
|
||||||
|
|
||||||
# ╭──────┬───────────╮
|
# ╭──────┬───────────╮
|
||||||
# │ main │ variables │
|
# │ main │ variables │
|
||||||
# ╰──────┴───────────╯
|
# ╰──────┴───────────╯
|
||||||
|
|
||||||
# system root directory of the project
|
# project main root directory
|
||||||
rwx_main_root="${RWX_MAIN_PARENT}/${RWX_MAIN_NAME}"
|
rwx_main_root="${RWX_MAIN_PARENT}/${RWX_MAIN_NAME}"
|
||||||
|
|
||||||
# ╭──────┬──────╮
|
# ╭──────┬──────╮
|
||||||
# │ main │ find │
|
# │ main │ find │
|
||||||
# ╰──────┴──────╯
|
# ╰──────┴──────╯
|
||||||
|
|
||||||
# find directory’s shell files
|
# find root directory shell modules
|
||||||
#| find
|
#| find
|
||||||
#| sed
|
#| sed
|
||||||
#| sort
|
#| sort
|
||||||
|
@ -46,13 +46,16 @@ rwx_main_find() {
|
||||||
# │ main │ main │
|
# │ main │ main │
|
||||||
# ╰──────┴──────╯
|
# ╰──────┴──────╯
|
||||||
|
|
||||||
# run initial steps
|
# run required initial steps
|
||||||
#< core/code
|
#< core/code
|
||||||
rwx_main_main() {
|
rwx_main_main() {
|
||||||
local module modules
|
local module
|
||||||
# find & source modules
|
local modules
|
||||||
|
# find main modules
|
||||||
modules="$(rwx_main_find "${rwx_main_root}")"
|
modules="$(rwx_main_find "${rwx_main_root}")"
|
||||||
|
# source main modules
|
||||||
while IFS= read -r module; do
|
while IFS= read -r module; do
|
||||||
|
# except currently running main module
|
||||||
if [ "${module}" != "${RWX_MAIN_MODULE}" ]; then
|
if [ "${module}" != "${RWX_MAIN_MODULE}" ]; then
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
. "${rwx_main_root}/${module}.${RWX_MAIN_EXTENSION}"
|
. "${rwx_main_root}/${module}.${RWX_MAIN_EXTENSION}"
|
||||||
|
@ -60,7 +63,7 @@ rwx_main_main() {
|
||||||
done <<EOF
|
done <<EOF
|
||||||
${modules}
|
${modules}
|
||||||
EOF
|
EOF
|
||||||
# run code main function
|
# run code module main function with found main modules
|
||||||
rwx_code_main "${modules}" "${@}"
|
rwx_code_main "${modules}" "${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue