diff --git a/sh/main.sh b/sh/main.sh index f591b46..c916049 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -51,6 +51,25 @@ _rwx_main_log() { # │ public │ # ╰────────╯ +# get functions from file +rwx_grep_functions() { + local file="${1}" + grep "()" "${file}" | + cut --delimiter "(" --fields 1 +} + +# test if active shell is in interactive mode +rwx_shell_interactive() { + case "${-}" in + *i*) ;; + *) return 1 ;; + esac +} + +# ╭──────╮ +# │ core │ +# ╰──────╯ + # find directory’s files by extension rwx_find_extension() { local extension="${1}" @@ -70,31 +89,16 @@ rwx_find_extension() { } # find directory’s sh files -rwx_find_sh() { +rwx_find_shell() { rwx_find_extension "sh" "${@}" } -# get functions from file -rwx_grep_functions() { - local file="${1}" - grep "()" "${file}" | - cut --delimiter "(" --fields 1 -} - -# test if active shell is in interactive mode -rwx_shell_interactive() { - case "${-}" in - *i*) ;; - *) return 1 ;; - esac -} - rwx_main_source() { local path="${1}" [ -d "${path}" ] || return 1 local cmd count module modules - modules="$(rwx_find_sh "${path}" "${RWX_MAIN_NAME}")" + modules="$(rwx_find_shell "${path}" "${RWX_MAIN_NAME}")" rwx_ifs_set count=0 _rwx_main_log "" \