diff --git a/sh/main.sh b/sh/main.sh index 9629b27..c7f34e4 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -64,6 +64,9 @@ rwx_main() { # │ main │ cache │ # ╰──────┴───────╯ +# cache of all sourced code modules +_rwx_code="" + # cache source code of a module # inside a global code variable rwx_cache() { @@ -74,7 +77,7 @@ rwx_cache() { local text text="$(cat "${path}")" # all source code - RWX_CODE="${RWX_CODE}\ + _rwx_code="${_rwx_code}\ #. ${name} ${text} " @@ -187,11 +190,11 @@ rwx_parse_code() { RWX_FUNCTIONS="$(rwx_parse_functions)" } rwx_parse_constants() { - printf "%s\n" "${RWX_CODE}" | + printf "%s\n" "${_rwx_code}" | sed --silent "s|${RWX_REGEX_TARGET_CONSTANT}|\\1|p" } rwx_parse_functions() { - printf "%s\n" "${RWX_CODE}" | + printf "%s\n" "${_rwx_code}" | sed --silent "s|${RWX_REGEX_TARGET_FUNCTION}|\\1|p" } @@ -211,6 +214,8 @@ rwx_test() { \ "RWX_MAIN_NAME" \ \ + "_rwx_code" \ + \ "rwx_cache" \ \ "gsc" diff --git a/sh/self.sh b/sh/self.sh index 169921a..cc10d56 100644 --- a/sh/self.sh +++ b/sh/self.sh @@ -5,7 +5,7 @@ rwx_doc() { local name="${1}" [ -n "${name}" ] || return - printf "%s" "${RWX_CODE}" | + printf "%s" "${_rwx_code}" | awk \ -f "${RWX_ROOT_SYSTEM}/doc.awk" \ -v target="${name}" @@ -55,7 +55,7 @@ rwx_doc_old() { ;; esac done <