_rwx_code
This commit is contained in:
parent
1b077ac89a
commit
0ef18c113e
2 changed files with 10 additions and 5 deletions
11
sh/main.sh
11
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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue