From 596126bb850f6045b583a0d7f188b925d2d498ef Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 13 Jul 2025 22:04:54 +0200 Subject: [PATCH] mawk/function --- sh/core/code.awk | 10 +++++----- sh/core/shell.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sh/core/code.awk b/sh/core/code.awk index 7b9fda0..b7da4ef 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -135,14 +135,14 @@ BEGIN { } else { reset() } - } else if (action == "command function") { - if (match($0, re["command"], m)) { - append(m[1]) - } else if (match($0, re["function"], m)) { + } else if (action == "function") { + if (match($0, re["command"])) { + append(extract($0, "command")) + } else if (match($0, re["function"])) { split(doc, array, "\n") for (item in array) { if (array[item] == target) { - print m[1] + print extract($0, "function") exit } } diff --git a/sh/core/shell.sh b/sh/core/shell.sh index dd3b744..ab3ace1 100644 --- a/sh/core/shell.sh +++ b/sh/core/shell.sh @@ -204,7 +204,7 @@ rwx_shell_main() { *) ;; esac # find the matching function - function="$(rwx_code_action_target "command function" "${command}")" + function="$(rwx_code_action_target "function" "${command}")" if [ -n "${function}" ]; then "${function}" "${@}" fi