awk/constants

This commit is contained in:
Marc Beninca 2025-07-07 02:27:41 +02:00
parent dbfe0e1407
commit fd281ee8d0
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 11 additions and 5 deletions

View file

@ -50,6 +50,10 @@ BEGIN {
if (match($0, RE_ALIAS, m)) {
print m[1]
}
} else if (action == "constants") {
if (match($0, RE_CONSTANT, m)) {
print m[1]
}
} else if (action == "functions") {
if (match($0, RE_FUNCTION, m)) {
print m[1]

View file

@ -222,23 +222,25 @@ EOF
_rwx_code_variables="$(rwx_parse_variables)"
}
rwx_parse_aliases() {
echo "${_rwx_code}" |
rwx_code |
awk \
--assign action="aliases" \
"${_rwx_code_awk}"
}
rwx_parse_aliases_functions() {
printf "%s" "${_rwx_code}" |
rwx_code |
awk \
--assign action="aliases functions" \
"${_rwx_code_awk}"
}
rwx_parse_constants() {
printf "%s" "${_rwx_code}" |
sed --silent "s|${RWX_REGEX_TARGET_CONSTANT}|\\1|p"
rwx_code |
awk \
--assign action="constants" \
"${_rwx_code_awk}"
}
rwx_parse_functions() {
echo "${_rwx_code}" |
rwx_code |
awk \
--assign action="functions" \
"${_rwx_code_awk}"