main/main

This commit is contained in:
Marc Beninca 2025-07-08 05:50:46 +02:00
parent 820ec05b13
commit 1345f07e16
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 8 additions and 12 deletions

View file

@ -76,9 +76,9 @@ _rwx_log() {
local line local line
for line in "${@}"; do for line in "${@}"; do
if [ -n "${prefix}" ]; then if [ -n "${prefix}" ]; then
__rwx_log "${prefix} ${line}" _rwx_main_log "${prefix} ${line}"
else else
__rwx_log "${line}" _rwx_main_log "${line}"
fi fi
done done
} }

View file

@ -69,7 +69,7 @@ rwx_shell_interactive() {
# │ main │ log │ # │ main │ log │
# ╰──────┴─────╯ # ╰──────┴─────╯
__rwx_log() { _rwx_main_log() {
if rwx_shell_interactive; then if rwx_shell_interactive; then
[ ${#} -gt 0 ] || set -- "" [ ${#} -gt 0 ] || set -- ""
local line local line
@ -91,12 +91,12 @@ rwx_source() {
local file="${2}" local file="${2}"
local count module modules local count module modules
count=0 count=0
__rwx_log "" \ _rwx_main_log "" \
". ${root}" ". ${root}"
modules="$(rwx_find_shell "${root}" "${file}")" modules="$(rwx_find_shell "${root}" "${file}")"
while IFS= read -r module; do while IFS= read -r module; do
count=$((count + 1)) count=$((count + 1))
__rwx_log "$(printf "%02d" "${count}") ${module%.sh}" _rwx_main_log "$(printf "%02d" "${count}") ${module%.sh}"
# shellcheck disable=SC1090 # shellcheck disable=SC1090
. "${root}/${module}" . "${root}/${module}"
# cache code # cache code
@ -133,21 +133,17 @@ ${text}
# run initial steps # run initial steps
#< code #< code
rwx_main() { rwx_main_main() {
# cache main # cache main
rwx_cache "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}" rwx_cache "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"
# source system root # source system root
if ! rwx_source "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"; then if ! rwx_source "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"; then
__rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}" _rwx_main_log "Not a directory: ${RWX_ROOT_SYSTEM}"
return 1 return 1
fi fi
# run code main function # run code main function
rwx_code_main rwx_code_main
} }
# ╭──────┬─────╮
# │ main │ run │
# ╰──────┴─────╯
# run main function # run main function
rwx_main "${@}" rwx_main_main "${@}"