_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 │
|
# │ main │ cache │
|
||||||
# ╰──────┴───────╯
|
# ╰──────┴───────╯
|
||||||
|
|
||||||
|
# cache of all sourced code modules
|
||||||
|
_rwx_code=""
|
||||||
|
|
||||||
# cache source code of a module
|
# cache source code of a module
|
||||||
# inside a global code variable
|
# inside a global code variable
|
||||||
rwx_cache() {
|
rwx_cache() {
|
||||||
|
@ -74,7 +77,7 @@ rwx_cache() {
|
||||||
local text
|
local text
|
||||||
text="$(cat "${path}")"
|
text="$(cat "${path}")"
|
||||||
# all source code
|
# all source code
|
||||||
RWX_CODE="${RWX_CODE}\
|
_rwx_code="${_rwx_code}\
|
||||||
#. ${name}
|
#. ${name}
|
||||||
${text}
|
${text}
|
||||||
"
|
"
|
||||||
|
@ -187,11 +190,11 @@ rwx_parse_code() {
|
||||||
RWX_FUNCTIONS="$(rwx_parse_functions)"
|
RWX_FUNCTIONS="$(rwx_parse_functions)"
|
||||||
}
|
}
|
||||||
rwx_parse_constants() {
|
rwx_parse_constants() {
|
||||||
printf "%s\n" "${RWX_CODE}" |
|
printf "%s\n" "${_rwx_code}" |
|
||||||
sed --silent "s|${RWX_REGEX_TARGET_CONSTANT}|\\1|p"
|
sed --silent "s|${RWX_REGEX_TARGET_CONSTANT}|\\1|p"
|
||||||
}
|
}
|
||||||
rwx_parse_functions() {
|
rwx_parse_functions() {
|
||||||
printf "%s\n" "${RWX_CODE}" |
|
printf "%s\n" "${_rwx_code}" |
|
||||||
sed --silent "s|${RWX_REGEX_TARGET_FUNCTION}|\\1|p"
|
sed --silent "s|${RWX_REGEX_TARGET_FUNCTION}|\\1|p"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,6 +214,8 @@ rwx_test() {
|
||||||
\
|
\
|
||||||
"RWX_MAIN_NAME" \
|
"RWX_MAIN_NAME" \
|
||||||
\
|
\
|
||||||
|
"_rwx_code" \
|
||||||
|
\
|
||||||
"rwx_cache" \
|
"rwx_cache" \
|
||||||
\
|
\
|
||||||
"gsc"
|
"gsc"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
rwx_doc() {
|
rwx_doc() {
|
||||||
local name="${1}"
|
local name="${1}"
|
||||||
[ -n "${name}" ] || return
|
[ -n "${name}" ] || return
|
||||||
printf "%s" "${RWX_CODE}" |
|
printf "%s" "${_rwx_code}" |
|
||||||
awk \
|
awk \
|
||||||
-f "${RWX_ROOT_SYSTEM}/doc.awk" \
|
-f "${RWX_ROOT_SYSTEM}/doc.awk" \
|
||||||
-v target="${name}"
|
-v target="${name}"
|
||||||
|
@ -55,7 +55,7 @@ rwx_doc_old() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done <<EOF
|
done <<EOF
|
||||||
${RWX_CODE}
|
${_rwx_code}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue