This commit is contained in:
parent
6a73a8a740
commit
8fd6beed11
1 changed files with 14 additions and 2 deletions
16
sh/main.sh
16
sh/main.sh
|
@ -46,6 +46,8 @@ rwx_main() {
|
||||||
fi
|
fi
|
||||||
# source user root
|
# source user root
|
||||||
rwx_source "${RWX_SELF_USER}"
|
rwx_source "${RWX_SELF_USER}"
|
||||||
|
# parse code cache
|
||||||
|
rwx_parse
|
||||||
# context / command
|
# context / command
|
||||||
if [ -n "${RWX_COMMAND_NAME}" ]; then
|
if [ -n "${RWX_COMMAND_NAME}" ]; then
|
||||||
"${RWX_SELF_COMMAND}${RWX_COMMAND_NAME}" "${@}"
|
"${RWX_SELF_COMMAND}${RWX_COMMAND_NAME}" "${@}"
|
||||||
|
@ -201,14 +203,24 @@ rwx_find_shell() {
|
||||||
|
|
||||||
rwx_parse() {
|
rwx_parse() {
|
||||||
local ws="[[:space:]]*"
|
local ws="[[:space:]]*"
|
||||||
|
local start="^${ws}"
|
||||||
|
local constant="[_A-Z][_0-9A-Z]*"
|
||||||
|
local setting="=.*"
|
||||||
local fn="${ws}(${ws})${ws}{"
|
local fn="${ws}(${ws})${ws}{"
|
||||||
local id="[_a-zA-Z][_a-z0-9A-Z]*"
|
local id="[_a-zA-Z][_a-z0-9A-Z]*"
|
||||||
local line
|
local line
|
||||||
rwx_ifs_set
|
rwx_ifs_set
|
||||||
|
RWX_CONSTANTS=""
|
||||||
|
for line in $(echo "${RWX_CODE}" |
|
||||||
|
grep "${start}${constant}${setting}" |
|
||||||
|
sed "s|${start}\\(${constant}\\)${setting}|\\1|"); do
|
||||||
|
RWX_CONSTANTS="${RWX_CONSTANTS}${line}
|
||||||
|
"
|
||||||
|
done
|
||||||
RWX_FUNCTIONS=""
|
RWX_FUNCTIONS=""
|
||||||
for line in $(echo "${RWX_CODE}" |
|
for line in $(echo "${RWX_CODE}" |
|
||||||
grep "^${ws}${id}${fn}" |
|
grep "${start}${id}${fn}" |
|
||||||
sed "s|^${ws}\\(${id}\\)${fn}.*|\\1|"); do
|
sed "s|${start}\\(${id}\\)${fn}.*|\\1|"); do
|
||||||
RWX_FUNCTIONS="${RWX_FUNCTIONS}${line}
|
RWX_FUNCTIONS="${RWX_FUNCTIONS}${line}
|
||||||
"
|
"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue