From 2183d22f4ea30d5b4d2541f59a33e80dd7bd2f57 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 2 Aug 2025 10:53:45 +0200 Subject: [PATCH] =?UTF-8?q?awk/=E2=86=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sh/core/code.awk | 62 ++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/sh/core/code.awk b/sh/core/code.awk index 7b18345..6418469 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -145,37 +145,6 @@ if (action == "tasks") { match_task = 0 } -# eval -} 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) { - alias_eval(array[item], extract($0, "function"), "function") - } - reset() - } else { - reset() - } - -# function -} 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 extract($0, "function") - exit - } - } - reset() - } else { - reset() - } - # doc } else if (action == "doc") { # doc @@ -243,6 +212,37 @@ if (action == "tasks") { } } +# function +} 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 extract($0, "function") + exit + } + } + reset() + } else { + reset() + } + +# eval +} 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) { + alias_eval(array[item], extract($0, "function"), "function") + } + reset() + } else { + reset() + } + # filter } else if (action == "filter") { if (match($0, re[target])) {