From fd281ee8d0c7aaec8e82f59b55f89c4fe1056201 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 7 Jul 2025 02:27:41 +0200 Subject: [PATCH] awk/constants --- sh/code.awk | 4 ++++ sh/main.sh | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/sh/code.awk b/sh/code.awk index 8a3208f..76c7641 100644 --- a/sh/code.awk +++ b/sh/code.awk @@ -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] diff --git a/sh/main.sh b/sh/main.sh index 947f368..7c5b831 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -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}"