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 { } else {
reset() reset()
} }
} else if (action == "command function") { } else if (action == "function") {
if (match($0, re["command"], m)) { if (match($0, re["command"])) {
append(m[1]) append(extract($0, "command"))
} else if (match($0, re["function"], m)) { } else if (match($0, re["function"])) {
split(doc, array, "\n") split(doc, array, "\n")
for (item in array) { for (item in array) {
if (array[item] == target) { if (array[item] == target) {
print m[1] print extract($0, "function")
exit exit
} }
} }

View file

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