mawk/tasks

This commit is contained in:
Marc Beninca 2025-07-13 20:24:07 +02:00
parent b0abc4db45
commit a57e3f4eea
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -23,6 +23,9 @@ function extract(string, type) {
} else if (type == "function") { } else if (type == "function") {
split(string, array, "()") split(string, array, "()")
return trim(array[1]) return trim(array[1])
} else if (type == "module") {
split(string, array, "#\\.")
return trim(array[2])
} else if ((type == "constant") || (type == "variable")) { } else if ((type == "constant") || (type == "variable")) {
split(string, array, "=") split(string, array, "=")
return trim(array[1]) return trim(array[1])
@ -90,7 +93,7 @@ BEGIN {
unique[extract($0, target)] = "" unique[extract($0, target)] = ""
} }
} else if (action == "tasks") { } else if (action == "tasks") {
if (match($0, RE_MODULE, m)) { if (match($0, RE_MODULE)) {
if (output_tasks) { if (output_tasks) {
print "" print ""
print output_module print output_module
@ -99,17 +102,17 @@ BEGIN {
} }
doc = "" doc = ""
match_task = 0 match_task = 0
output_module = ". " m[1] output_module = ". " extract($0, "module")
} else if (match($0, RE_TASK, m)) { } else if (match($0, RE_TASK)) {
if (target) { if (target) {
if (target == m[1]) { if (target == extract($0, "task")) {
match_task = 1 match_task = 1
} }
} else { } else {
match_task = 1 match_task = 1
} }
append($0) append($0)
} else if (match($0, RE_COMMENT, m)) { } else if (match($0, RE_COMMENT)) {
append($0) append($0)
} else { } else {
if (match_task) { if (match_task) {