From 80f244fb08e1081d621b843e8a3b3bd184c616b8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 13 Jul 2025 21:57:38 +0200 Subject: [PATCH] mawk/eval --- sh/core/code.awk | 18 +++--------------- sh/core/code.sh | 8 ++++---- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/sh/core/code.awk b/sh/core/code.awk index 2c267e8..7b9fda0 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -123,21 +123,9 @@ BEGIN { doc = "" match_task = 0 } - } else if (action == "aliases functions") { - if (match($0, re["alias"])) { - append(extract($0, "alias")) - } else if (match($0, re["function"])) { - split(doc, array, "\n") - for (item in array) { - alias_eval(array[item], extract($0, "function"), "function") - } - reset() - } else { - reset() - } - } else if (action == "commands functions") { - if (match($0, re["command"])) { - append(extract($0, "command")) + } else if (action == "eval") { + if (match($0, re[target])) { + append(extract($0, target)) } else if (match($0, re["function"])) { split(doc, array, "\n") for (item in array) { diff --git a/sh/core/code.sh b/sh/core/code.sh index 0331c4c..a9bea2c 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -238,15 +238,15 @@ rwx_code_doc() { rwx_code_load() { local line - # parse aliases functions - _rwx_code_aliases_functions="$(rwx_code_parse "aliases functions")" + # parse functions aliases + _rwx_code_aliases_functions="$(rwx_code_action_target "eval" "alias")" while IFS= read -r line; do eval "${line}" done <