diff --git a/readme.md b/readme.md index db7e87d..532211c 100644 --- a/readme.md +++ b/readme.md @@ -117,6 +117,5 @@ Two interpreted languages for flexibility. * get unresolved path for new panes & windows * fully working doc function algorithm * self install aliases -* list aliases ### 6.2 [Further tasks](#when) {#when-further} diff --git a/sh/code.sh b/sh/code.sh deleted file mode 100644 index 2c4c5ed..0000000 --- a/sh/code.sh +++ /dev/null @@ -1,70 +0,0 @@ -# ╭──────╮ -# │ code │ -# ╰──────╯ - -# ╭──────┬───────────╮ -# │ code │ variables │ -# ╰──────┴───────────╯ - -# path to the required parsing awk script -_rwx_code_awk="$(cat "${RWX_ROOT_SYSTEM}/code.awk")" - -# ╭──────┬───────╮ -# │ code │ parts │ -# ╰──────┴───────╯ - -# show the cached code -#= rc -rwx_code() { - echo "${_rwx_code}" -} - -# show the cached aliases and functions -#= rcaf -rwx_code_aliases_functions() { - echo "${_rwx_code_aliases_functions}" -} - -# show the cached constants -#= rcc -rwx_code_constants() { - echo "${_rwx_code_constants}" -} - -# show the cached functions -#= rcf -rwx_code_functions() { - echo "${_rwx_code_functions}" -} - -# show the cached variables -#= rcv -rwx_code_variables() { - echo "${_rwx_code_variables}" -} - -# ╭──────┬───────╮ -# │ code │ parse │ -# ╰──────┴───────╯ - -# check source code -rwx_code_check() { - # check format - rwx_log - rwx_shfmt "${RWX_ROOT_SYSTEM}" - # check syntax - rwx_log - rwx_shellcheck "${RWX_ROOT_SYSTEM}" -} - -# fetch matching doc for given name -#= rcd -rwx_code_doc() { - local name="${1}" - [ -n "${name}" ] || return - printf "%s" "${_rwx_code}" | - awk \ - --assign action="doc" \ - --assign target="${name}" \ - "${_rwx_code_awk}" -} diff --git a/sh/log/log.sh b/sh/log/log.sh index a3013e8..a7bb0f4 100644 --- a/sh/log/log.sh +++ b/sh/log/log.sh @@ -23,8 +23,6 @@ RWX_LOG_LEVEL=${RWX_LOG_LEVEL_INFO} # │ log │ log │ # ╰─────┴─────╯ -rwx_log() { rwx_log_info "${@}"; } - rwx_log_debug() { if [ "${RWX_LOG_LEVEL}" -ge "${RWX_LOG_LEVEL_DEBUG}" ]; then _rwx_log "[DEBUG]" "${@}" @@ -51,6 +49,7 @@ rwx_log_fatal() { fi } +#= rwx_log rwx_log_info() { if [ "${RWX_LOG_LEVEL}" -ge "${RWX_LOG_LEVEL_INFO}" ]; then _rwx_log "" "${@}" diff --git a/sh/code.awk b/sh/main.awk similarity index 100% rename from sh/code.awk rename to sh/main.awk diff --git a/sh/main.sh b/sh/main.sh index f1be786..22344e8 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -3,15 +3,6 @@ # │ main │ # ╰──────╯ # main module -# * builtins -# * echo -# * printf -# * read -# * binaries -# * awk -# * cat -# * find -# * sed # ╭──────┬───────────╮ # │ main │ constants │ @@ -45,6 +36,8 @@ RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}" # user root directory of the project RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}" +# path to the required parsing awk script +RWX_AWK="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME%.sh}.awk" # path to the entrypoint main file of the project RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}" @@ -202,28 +195,28 @@ ${RWX_REGEX_BEGIN}\\(${RWX_REGEX_VARIABLE}\\)${RWX_REGEX_SET}" _rwx_code_variables="" rwx_parse_code() { - # parse aliases commands + # parse aliases local line text - _rwx_code_aliases_functions="$(rwx_parse_aliases_functions)" + RWX_ALIASES="$(rwx_parse_aliases)" while IFS= read -r line; do text="$(echo "${line}" | sed "s| |() { |")" text="${text} \"\${@}\"; }" eval "${text}" done <