code/parse
This commit is contained in:
parent
09c0721560
commit
b2e965da92
1 changed files with 5 additions and 36 deletions
41
sh/code.sh
41
sh/code.sh
|
@ -92,10 +92,10 @@ rwx_code_doc() {
|
||||||
|
|
||||||
rwx_code_load() {
|
rwx_code_load() {
|
||||||
# parse aliases
|
# parse aliases
|
||||||
_rwx_code_aliases="$(rwx_parse_aliases)"
|
_rwx_code_aliases="$(rwx_code_parse "aliases")"
|
||||||
# parse aliases functions
|
# parse aliases functions
|
||||||
local line text
|
local line text
|
||||||
_rwx_code_aliases_functions="$(rwx_parse_aliases_functions)"
|
_rwx_code_aliases_functions="$(rwx_code_parse "aliases functions")"
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
text="$(echo "${line}" | sed "s| |() { |")"
|
text="$(echo "${line}" | sed "s| |() { |")"
|
||||||
text="${text} \"\${@}\"; }"
|
text="${text} \"\${@}\"; }"
|
||||||
|
@ -104,11 +104,11 @@ rwx_code_load() {
|
||||||
${_rwx_code_aliases_functions}
|
${_rwx_code_aliases_functions}
|
||||||
EOF
|
EOF
|
||||||
# parse constants
|
# parse constants
|
||||||
_rwx_code_constants="$(rwx_parse_constants)"
|
_rwx_code_constants="$(rwx_code_parse "constants")"
|
||||||
# parse functions
|
# parse functions
|
||||||
_rwx_code_functions="$(rwx_parse_functions)"
|
_rwx_code_functions="$(rwx_code_parse "functions")"
|
||||||
# parse variables
|
# parse variables
|
||||||
_rwx_code_variables="$(rwx_parse_variables)"
|
_rwx_code_variables="$(rwx_code_parse "variables")"
|
||||||
}
|
}
|
||||||
|
|
||||||
rwx_code_parse() {
|
rwx_code_parse() {
|
||||||
|
@ -118,34 +118,3 @@ rwx_code_parse() {
|
||||||
--assign action="${action}" \
|
--assign action="${action}" \
|
||||||
"${_rwx_code_awk}"
|
"${_rwx_code_awk}"
|
||||||
}
|
}
|
||||||
|
|
||||||
rwx_parse_aliases() {
|
|
||||||
rwx_code |
|
|
||||||
awk \
|
|
||||||
--assign action="aliases" \
|
|
||||||
"${_rwx_code_awk}"
|
|
||||||
}
|
|
||||||
rwx_parse_aliases_functions() {
|
|
||||||
rwx_code |
|
|
||||||
awk \
|
|
||||||
--assign action="aliases functions" \
|
|
||||||
"${_rwx_code_awk}"
|
|
||||||
}
|
|
||||||
rwx_parse_constants() {
|
|
||||||
rwx_code |
|
|
||||||
awk \
|
|
||||||
--assign action="constants" \
|
|
||||||
"${_rwx_code_awk}"
|
|
||||||
}
|
|
||||||
rwx_parse_functions() {
|
|
||||||
rwx_code |
|
|
||||||
awk \
|
|
||||||
--assign action="functions" \
|
|
||||||
"${_rwx_code_awk}"
|
|
||||||
}
|
|
||||||
rwx_parse_variables() {
|
|
||||||
rwx_code |
|
|
||||||
awk \
|
|
||||||
--assign action="variables" \
|
|
||||||
"${_rwx_code_awk}"
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue