code/load
This commit is contained in:
parent
45f0ebbb9b
commit
0b12a7545e
2 changed files with 53 additions and 57 deletions
51
sh/code.sh
51
sh/code.sh
|
@ -89,3 +89,54 @@ rwx_code_doc() {
|
|||
--assign target="${name}" \
|
||||
"${_rwx_code_awk}"
|
||||
}
|
||||
|
||||
rwx_code_load() {
|
||||
# parse aliases
|
||||
_rwx_code_aliases="$(rwx_parse_aliases)"
|
||||
# parse aliases functions
|
||||
local line text
|
||||
_rwx_code_aliases_functions="$(rwx_parse_aliases_functions)"
|
||||
while IFS= read -r line; do
|
||||
text="$(echo "${line}" | sed "s| |() { |")"
|
||||
text="${text} \"\${@}\"; }"
|
||||
eval "${text}"
|
||||
done <<EOF
|
||||
${_rwx_code_aliases_functions}
|
||||
EOF
|
||||
# parse constants
|
||||
_rwx_code_constants="$(rwx_parse_constants)"
|
||||
# parse functions
|
||||
_rwx_code_functions="$(rwx_parse_functions)"
|
||||
# parse variables
|
||||
_rwx_code_variables="$(rwx_parse_variables)"
|
||||
}
|
||||
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