mawk/function

This commit is contained in:
Marc Beninca 2025-07-13 22:04:54 +02:00
parent 80f244fb08
commit 596126bb85
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 6 additions and 6 deletions

View file

@ -135,14 +135,14 @@ BEGIN {
} else {
reset()
}
} else if (action == "command function") {
if (match($0, re["command"], m)) {
append(m[1])
} else if (match($0, re["function"], m)) {
} 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 m[1]
print extract($0, "function")
exit
}
}

View file

@ -204,7 +204,7 @@ rwx_shell_main() {
*) ;;
esac
# find the matching function
function="$(rwx_code_action_target "command function" "${command}")"
function="$(rwx_code_action_target "function" "${command}")"
if [ -n "${function}" ]; then
"${function}" "${@}"
fi