From a17596b862ba29fdb599aa1c41b7ff1b232f1952 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 10 Jul 2025 02:09:54 +0200 Subject: [PATCH 1/4] code/cache --- sh/core/code.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sh/core/code.sh b/sh/core/code.sh index 0d308f3..09d6c91 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -6,6 +6,10 @@ # │ code │ variables │ # ╰──────┴───────────╯ +# main modules code cache +rwx_code_cache_main="" +# user modules code cache +rwx_code_cache_user="" # main modules names rwx_code_modules_main="" # user modules names @@ -34,6 +38,26 @@ _rwx_code_functions="" # cache for code variables _rwx_code_variables="" +# ╭──────┬───────╮ +# │ code │ cache │ +# ╰──────┴───────╯ + +# output all cached code +rwx_code_cache() { + rwx_code_cache_main + rwx_code_cache_user +} + +# output cached main code +rwx_code_cache_main() { + echo "${rwx_code_cache_main}" +} + +# output cached user code +rwx_code_cache_user() { + echo "${rwx_code_cache_user}" +} + # ╭──────┬──────╮ # │ code │ help │ # ╰──────┴──────╯ From 0cf3266af0d13a4daaeae8a7a46627f3e8af02da Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 10 Jul 2025 02:11:22 +0200 Subject: [PATCH 2/4] =?UTF-8?q?code/=E2=86=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sh/core/code.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sh/core/code.sh b/sh/core/code.sh index 09d6c91..d4c6f9a 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -6,6 +6,9 @@ # │ code │ variables │ # ╰──────┴───────────╯ +# user root directory of the project +rwx_code_root="${HOME}/${RWX_MAIN_NAME}" + # main modules code cache rwx_code_cache_main="" # user modules code cache @@ -14,8 +17,6 @@ rwx_code_cache_user="" rwx_code_modules_main="" # user modules names rwx_code_modules_user="" -# user root directory of the project -rwx_code_root="${HOME}/${RWX_MAIN_NAME}" # cache of all sourced code modules _rwx_code="" From 7d607f1c61f199df5d47cd6b3cc61991b7293877 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 10 Jul 2025 02:25:31 +0200 Subject: [PATCH 3/4] cache/main,user --- sh/core/code.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sh/core/code.sh b/sh/core/code.sh index d4c6f9a..5e1cf09 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -285,7 +285,8 @@ EOF # cache main modules while IFS= read -r module; do # cache main module - _rwx_code="${_rwx_code}#. ${module} + rwx_code_cache_main="${rwx_code_cache_main}\ +#. ${module} $(cat "${rwx_main_root}/${module}.${RWX_MAIN_EXTENSION}") " done < Date: Thu, 10 Jul 2025 02:59:25 +0200 Subject: [PATCH 4/4] code/cache --- sh/core/code.sh | 14 +++----------- sh/test.sh | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/sh/core/code.sh b/sh/core/code.sh index 5e1cf09..c87ad35 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -18,8 +18,6 @@ rwx_code_modules_main="" # user modules names rwx_code_modules_user="" -# cache of all sourced code modules -_rwx_code="" # cache for the parsing awk script _rwx_code_awk="$(cat "${rwx_main_root}/core/code.awk")" # cache for code aliases @@ -114,12 +112,6 @@ export ENV=\"${rwx_main_path}\" # │ code │ parts │ # ╰──────┴───────╯ -# show the cached code -#= rc -rwx_code() { - echo "${_rwx_code}" -} - # show the cached awk script rwx_code_awk() { echo "${_rwx_code_awk}" @@ -135,7 +127,7 @@ rwx_code_aliases() { rwx_code_command_function() { local name="${1}" [ -n "${name}" ] || return - rwx_code | + rwx_code_cache | awk \ -v action="command function" \ -v target="${name}" \ @@ -220,7 +212,7 @@ rwx_code_check() { rwx_code_doc() { local name="${1}" [ -n "${name}" ] || return - rwx_code | + rwx_code_cache | awk \ -v action="doc" \ -v target="${name}" \ @@ -259,7 +251,7 @@ EOF rwx_code_parse() { local action="${1}" - rwx_code | + rwx_code_cache | awk \ -v action="${action}" \ "${_rwx_code_awk}" diff --git a/sh/test.sh b/sh/test.sh index 1ef31ec..b7385f2 100644 --- a/sh/test.sh +++ b/sh/test.sh @@ -43,7 +43,7 @@ rwx_test_doc() { \ "RWX_MAIN_MODULE" \ \ - "_rwx_code" \ + "rwx_code_cache_main" \ \ "rwx_main_cache" \ \