main/log
This commit is contained in:
parent
4b2cc9a243
commit
e4d0b71e5d
1 changed files with 17 additions and 17 deletions
34
sh/main.sh
34
sh/main.sh
|
@ -16,20 +16,6 @@ RWX_SHELL="$(cat "/proc/${$}/comm")"
|
|||
|
||||
RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}"
|
||||
|
||||
# ╭─────────╮
|
||||
# │ private │
|
||||
# ╰─────────╯
|
||||
|
||||
_rwx_main_log() {
|
||||
if rwx_shell_interactive; then
|
||||
[ ${#} -gt 0 ] || set -- ""
|
||||
local line
|
||||
for line in "${@}"; do
|
||||
echo "${line}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# ╭────────╮
|
||||
# │ public │
|
||||
# ╰────────╯
|
||||
|
@ -53,6 +39,20 @@ rwx_shell_interactive() {
|
|||
# │ core │
|
||||
# ╰──────╯
|
||||
|
||||
# ╭──────┬─────╮
|
||||
# │ core │ log │
|
||||
# ╰──────┴─────╯
|
||||
|
||||
__rwx_log() {
|
||||
if rwx_shell_interactive; then
|
||||
[ ${#} -gt 0 ] || set -- ""
|
||||
local line
|
||||
for line in "${@}"; do
|
||||
echo "${line}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# ╭──────┬──────╮
|
||||
# │ core │ find │
|
||||
# ╰──────┴──────╯
|
||||
|
@ -107,11 +107,11 @@ rwx_source() {
|
|||
modules="$(rwx_find_shell "${path}" "${RWX_MAIN_NAME}")"
|
||||
rwx_ifs_set
|
||||
count=0
|
||||
_rwx_main_log "" \
|
||||
__rwx_log "" \
|
||||
". ${path}"
|
||||
for module in ${modules}; do
|
||||
count=$((count + 1))
|
||||
_rwx_main_log "$(printf "%02d" "${count}") ${module%.sh}"
|
||||
__rwx_log "$(printf "%02d" "${count}") ${module%.sh}"
|
||||
module="${path}/${module}"
|
||||
# shellcheck disable=SC1090
|
||||
. "${module}"
|
||||
|
@ -133,7 +133,7 @@ rwx_source() {
|
|||
rwx_main() {
|
||||
# system root
|
||||
if ! rwx_source "${RWX_ROOT_SYSTEM}"; then
|
||||
_rwx_main_log "Not a directory: ${RWX_ROOT_SYSTEM}"
|
||||
__rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}"
|
||||
return 1
|
||||
fi
|
||||
# user root
|
||||
|
|
Loading…
Reference in a new issue