diff --git a/sh/main.sh b/sh/main.sh index eb938e8..802418f 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -136,18 +136,7 @@ rwx_main() { "${RWX_SELF_COMMAND}${RWX_COMMAND_NAME}" "${@}" # context / shell else - # run interactive extras - if rwx_shell_interactive; then - # check format - rwx_log - rwx_shfmt "${RWX_ROOT_SYSTEM}" - # check syntax - rwx_log - rwx_shellcheck "${RWX_ROOT_SYSTEM}" - # help - rwx_log - rwx_self_help - fi + rwx_self_init fi } diff --git a/sh/self.sh b/sh/self.sh index 41a2a0c..c6fad3b 100644 --- a/sh/self.sh +++ b/sh/self.sh @@ -1,3 +1,7 @@ +# ╭──────┬──────────╮ +# │ self │ commands │ +# ╰──────┴──────────╯ + # get commands from root rwx_self_commands() { grep \ @@ -8,6 +12,10 @@ rwx_self_commands() { sed "s|^${RWX_SELF_COMMAND}||" } +# ╭──────┬───────────╮ +# │ self │ functions │ +# ╰──────┴───────────╯ + # get functions from root rwx_self_functions() { grep \ @@ -17,6 +25,10 @@ rwx_self_functions() { cut --delimiter "(" --fields 1 } +# ╭──────┬──────╮ +# │ self │ help │ +# ╰──────┴──────╯ + # output help message rwx_self_help() { rwx_log \ @@ -25,6 +37,29 @@ rwx_self_help() { " u__… = user" } +# ╭──────┬──────╮ +# │ self │ init │ +# ╰──────┴──────╯ + +rwx_self_init() { + # run interactive extras + if rwx_shell_interactive; then + # check format + rwx_log + rwx_shfmt "${RWX_ROOT_SYSTEM}" + # check syntax + rwx_log + rwx_shellcheck "${RWX_ROOT_SYSTEM}" + # help + rwx_log + rwx_self_help + fi +} + +# ╭──────┬─────────╮ +# │ self │ install │ +# ╰──────┴─────────╯ + _rwx_cmd_rwx_install() { rwx_self_install "${@}"; } rwx_self_install() { local target="${1}" @@ -46,6 +81,10 @@ rwx_self_install() { rwx_link "${file}" "${RWX_MAIN_PATH}" } +# ╭──────┬────────╮ +# │ self │ subset │ +# ╰──────┴────────╯ + rwx_self_subset() { local argument path for argument in "${@}"; do @@ -61,6 +100,10 @@ rwx_self_subset() { done } +# ╭──────┬───────╮ +# │ self │ write │ +# ╰──────┴───────╯ + rwx_self_write() { local target="${1}" if [ -n "${target}" ]; then