Compare commits
4 commits
13ab4b8ec7
...
bcf879ddc3
Author | SHA1 | Date | |
---|---|---|---|
bcf879ddc3 | |||
7d607f1c61 | |||
0cf3266af0 | |||
a17596b862 |
2 changed files with 35 additions and 16 deletions
|
@ -6,15 +6,18 @@
|
|||
# │ 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
|
||||
rwx_code_cache_user=""
|
||||
# main modules names
|
||||
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=""
|
||||
# cache for the parsing awk script
|
||||
_rwx_code_awk="$(cat "${rwx_main_root}/core/code.awk")"
|
||||
# cache for code aliases
|
||||
|
@ -34,6 +37,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 │
|
||||
# ╰──────┴──────╯
|
||||
|
@ -89,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}"
|
||||
|
@ -110,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}" \
|
||||
|
@ -195,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}" \
|
||||
|
@ -234,7 +251,7 @@ EOF
|
|||
|
||||
rwx_code_parse() {
|
||||
local action="${1}"
|
||||
rwx_code |
|
||||
rwx_code_cache |
|
||||
awk \
|
||||
-v action="${action}" \
|
||||
"${_rwx_code_awk}"
|
||||
|
@ -260,7 +277,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 <<EOF
|
||||
|
@ -269,7 +287,8 @@ EOF
|
|||
# cache user modules
|
||||
while IFS= read -r module; do
|
||||
# cache user module
|
||||
_rwx_code="${_rwx_code}#. ${module}
|
||||
rwx_code_cache_user="${rwx_code_cache_user}\
|
||||
#. ${module}
|
||||
$(cat "${rwx_code_root}/${module}.${RWX_MAIN_EXTENSION}")
|
||||
"
|
||||
done <<EOF
|
||||
|
|
|
@ -43,7 +43,7 @@ rwx_test_doc() {
|
|||
\
|
||||
"RWX_MAIN_MODULE" \
|
||||
\
|
||||
"_rwx_code" \
|
||||
"rwx_code_cache_main" \
|
||||
\
|
||||
"rwx_main_cache" \
|
||||
\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue