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") {
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) {