filter/functions

This commit is contained in:
Marc Beninca 2025-07-11 03:17:22 +02:00
parent e4ac8f0ae6
commit 65d701556a
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 6 additions and 10 deletions

View file

@ -43,7 +43,7 @@ BEGIN {
RE_COMMENT = RE_BEGIN "#" RE_ANY RE_END
RE_CONSTANT = RE_BEGIN RE_CONST RE_SET RE_END
RE_DOC = RE_BEGIN RE_SPACES "#" RE_SPACE RE_ANY RE_END
RE_FUNCTION = RE_BEGIN RE_VAR RE_FUNC RE_END
re["function"] = RE_BEGIN RE_VAR RE_FUNC RE_END
RE_MODULE = RE_BEGIN "#\\." RE_SPACES RE_ANY RE_END
RE_SHEBANG = RE_BEGIN "#!" RE_SPACES RE_ANY RE_END
RE_TASK = RE_BEGIN RE_SPACES "#" RE_SPACES RE_TSK RE_ANY RE_END
@ -74,10 +74,6 @@ BEGIN {
if (match($0, RE_CONSTANT, m)) {
print m[1]
}
} else if (action == "functions") {
if (match($0, RE_FUNCTION, m)) {
print m[1]
}
} else if (action == "tasks") {
if (match($0, RE_MODULE, m)) {
if (output_tasks) {
@ -108,7 +104,7 @@ BEGIN {
} else if (action == "aliases functions") {
if (match($0, re["alias"], m)) {
append(m[1])
} else if (match($0, RE_FUNCTION, m)) {
} else if (match($0, re["function"], m)) {
split(doc, array, "\n")
for (item in array) {
eval(array[item], m[1])
@ -120,7 +116,7 @@ BEGIN {
} else if (action == "commands functions") {
if (match($0, RE_COMMAND, m)) {
append(m[1])
} else if (match($0, RE_FUNCTION, m)) {
} else if (match($0, re["function"], m)) {
split(doc, array, "\n")
for (item in array) {
eval(array[item], m[1])
@ -132,7 +128,7 @@ BEGIN {
} else if (action == "command function") {
if (match($0, RE_COMMAND, m)) {
append(m[1])
} else if (match($0, RE_FUNCTION, m)) {
} else if (match($0, re["function"], m)) {
split(doc, array, "\n")
for (item in array) {
if (array[item] == target) {
@ -183,7 +179,7 @@ BEGIN {
if (m[1] == target) {
match_module = 1
}
} else if (match($0, RE_FUNCTION, m)) {
} else if (match($0, re["function"], m)) {
f = m[1]
} else if (match($0, RE_CLOSE, m)) {
if (match_alias) {