diff --git a/sh/main.sh b/sh/main.sh index c916049..e85f519 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -16,27 +16,10 @@ RWX_SHELL="$(cat "/proc/${$}/comm")" RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}" -# ╭──────────╮ -# │ internal │ -# ╰──────────╯ - -# _RWX_IFS - # ╭─────────╮ # │ private │ # ╰─────────╯ -rwx_ifs_set() { - _RWX_IFS="${IFS}" - IFS=" -" -} - -rwx_ifs_unset() { - IFS="${_RWX_IFS}" - unset RWX_IFS -} - _rwx_main_log() { if rwx_shell_interactive; then [ ${#} -gt 0 ] || set -- "" @@ -70,6 +53,10 @@ rwx_shell_interactive() { # │ core │ # ╰──────╯ +# ╭──────┬──────╮ +# │ core │ find │ +# ╰──────┴──────╯ + # find directory’s files by extension rwx_find_extension() { local extension="${1}" @@ -93,7 +80,26 @@ rwx_find_shell() { rwx_find_extension "sh" "${@}" } -rwx_main_source() { +# ╭──────┬─────╮ +# │ core │ ifs │ +# ╰──────┴─────╯ + +rwx_ifs_set() { + _RWX_IFS="${IFS}" + IFS=" +" +} + +rwx_ifs_unset() { + IFS="${_RWX_IFS}" + unset RWX_IFS +} + +# ╭──────┬────────╮ +# │ core │ source │ +# ╰──────┴────────╯ + +rwx_source() { local path="${1}" [ -d "${path}" ] || return 1 @@ -119,19 +125,19 @@ rwx_main_source() { rwx_ifs_unset } -# ╭──────╮ -# │ main │ -# ╰──────╯ +# ╭──────┬──────╮ +# │ core │ main │ +# ╰──────┴──────╯ # run initial steps rwx_main() { # system root - if ! rwx_main_source "${RWX_ROOT_SYSTEM}"; then + if ! rwx_source "${RWX_ROOT_SYSTEM}"; then _rwx_main_log "Not a directory: ${RWX_ROOT_SYSTEM}" return 1 fi # user root - rwx_main_source "${RWX_ROOT_USER}" + rwx_source "${RWX_ROOT_USER}" # run interactive extras if rwx_shell_interactive; then # check format