From a57e3f4eea0f5af6c1e1e43487592367928fa02d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 13 Jul 2025 20:24:07 +0200 Subject: [PATCH] mawk/tasks --- sh/core/code.awk | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sh/core/code.awk b/sh/core/code.awk index 469d8f0..6565d02 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -23,6 +23,9 @@ function extract(string, type) { } else if (type == "function") { split(string, array, "()") return trim(array[1]) + } else if (type == "module") { + split(string, array, "#\\.") + return trim(array[2]) } else if ((type == "constant") || (type == "variable")) { split(string, array, "=") return trim(array[1]) @@ -90,7 +93,7 @@ BEGIN { unique[extract($0, target)] = "" } } else if (action == "tasks") { - if (match($0, RE_MODULE, m)) { + if (match($0, RE_MODULE)) { if (output_tasks) { print "" print output_module @@ -99,17 +102,17 @@ BEGIN { } doc = "" match_task = 0 - output_module = ". " m[1] - } else if (match($0, RE_TASK, m)) { + output_module = ". " extract($0, "module") + } else if (match($0, RE_TASK)) { if (target) { - if (target == m[1]) { + if (target == extract($0, "task")) { match_task = 1 } } else { match_task = 1 } append($0) - } else if (match($0, RE_COMMENT, m)) { + } else if (match($0, RE_COMMENT)) { append($0) } else { if (match_task) {