diff --git a/sh/code.awk b/sh/core/code.awk similarity index 100% rename from sh/code.awk rename to sh/core/code.awk diff --git a/sh/code.sh b/sh/core/code.sh similarity index 91% rename from sh/code.sh rename to sh/core/code.sh index 5a67869..a4a5eb0 100644 --- a/sh/code.sh +++ b/sh/core/code.sh @@ -8,12 +8,12 @@ # TODO variablize # path to the entrypoint main file of the project -RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}" +RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}.${RWX_MAIN_EXTENSION}" # user root directory of the project RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}" # cache for the parsing awk script -_rwx_code_awk="$(cat "${RWX_ROOT_SYSTEM}/code.awk")" +_rwx_code_awk="$(cat "${RWX_ROOT_SYSTEM}/core/code.awk")" # cache for code aliases _rwx_code_aliases="" # cache for code aliases functions @@ -37,7 +37,7 @@ _rwx_code_variables="" # output help message rwx_code_help() { - rwx_log \ + rwx_log "" \ "rwx_… = functions" \ " a__… = aliases" \ " u__… = user" @@ -59,7 +59,7 @@ rwx_code_install() { fi # commands root="${target}/usr/local/bin" - name="${RWX_SELF_NAME}.sh" + name="${RWX_SELF_NAME}.${RWX_MAIN_EXTENSION}" file="${root}/${name}" rwx_remove "${file}" rwx_link "${file}" "${RWX_MAIN_PATH}" @@ -71,7 +71,7 @@ rwx_code_install() { ${_rwx_code_commands} EOF # sh - file="${target}/etc/profile.d/${RWX_SELF_NAME}.sh" + file="${target}/etc/profile.d/${RWX_SELF_NAME}.${RWX_MAIN_EXTENSION}" rwx_remove "${file}" rwx_file_write "${file}" "\ export ENV=\"${RWX_MAIN_PATH}\" @@ -109,8 +109,8 @@ rwx_code_command_function() { [ -n "${name}" ] || return rwx_code | awk \ - --assign action="command function" \ - --assign target="${name}" \ + -v action="command function" \ + -v target="${name}" \ "${_rwx_code_awk}" } @@ -175,13 +175,13 @@ rwx_code_doc() { [ -n "${name}" ] || return rwx_code | awk \ - --assign action="doc" \ - --assign target="${name}" \ + -v action="doc" \ + -v target="${name}" \ "${_rwx_code_awk}" } rwx_code_load() { - local line text + local line # parse aliases functions _rwx_code_aliases_functions="$(rwx_code_parse "aliases functions")" while IFS= read -r line; do @@ -214,7 +214,7 @@ rwx_code_parse() { local action="${1}" rwx_code | awk \ - --assign action="${action}" \ + -v action="${action}" \ "${_rwx_code_awk}" } @@ -246,11 +246,7 @@ rwx_code_main() { fi # context / shell else - # run interactive extras - if rwx_shell_interactive; then - # help - rwx_log - rwx_code_help - fi + # display help + rwx_code_help fi } diff --git a/sh/lint/shellcheck.sh b/sh/lint/shellcheck.sh index 0253062..75101f2 100644 --- a/sh/lint/shellcheck.sh +++ b/sh/lint/shellcheck.sh @@ -2,9 +2,9 @@ rwx_shellcheck() { local root="${1}" local file module modules path file="$(mktemp)" - modules="$(rwx_find_shell "${root}")" + modules="$(rwx_main_find "${root}")" while IFS= read -r module; do - path="${root}/${module}" + path="${root}/${module}.${RWX_MAIN_EXTENSION}" echo ". \"${path}\"" >>"${file}" done <