code/commands

This commit is contained in:
Marc Beninca 2025-07-11 23:34:46 +02:00
parent 28064567e1
commit 148a9aef96
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 5 additions and 9 deletions

View file

@ -43,7 +43,7 @@ BEGIN {
re["alias"] = RE_BEGIN "#=" RE_SPACES RE_VAR RE_END
re["binary"] = RE_BEGIN "#\\|" RE_SPACES RE_VAR RE_END
RE_CLOSE = RE_BEGIN "}" RE_SPACES RE_END
RE_COMMAND = RE_BEGIN "#/" RE_SPACES RE_VAR RE_END
re["command"] = RE_BEGIN "#/" RE_SPACES RE_VAR RE_END
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
@ -66,10 +66,6 @@ BEGIN {
if (match($0, re[target], m)) {
unique[m[1]] = ""
}
} else if (action == "commands") {
if (match($0, RE_COMMAND, m)) {
print m[1]
}
} else if (action == "tasks") {
if (match($0, RE_MODULE, m)) {
if (output_tasks) {
@ -116,7 +112,7 @@ BEGIN {
reset()
}
} else if (action == "commands functions") {
if (match($0, RE_COMMAND, m)) {
if (match($0, re["command"], m)) {
append(m[1])
} else if (match($0, re["function"], m)) {
split(doc, array, "\n")
@ -128,7 +124,7 @@ BEGIN {
reset()
}
} else if (action == "command function") {
if (match($0, RE_COMMAND, m)) {
if (match($0, re["command"], m)) {
append(m[1])
} else if (match($0, re["function"], m)) {
split(doc, array, "\n")
@ -157,7 +153,7 @@ BEGIN {
if (m[1] == target) {
match_alias = 1
}
} else if (match($0, RE_COMMAND, m)) {
} else if (match($0, re["command"], m)) {
append("/ " m[1])
if (m[1] == target) {
match_command = 1

View file

@ -266,7 +266,7 @@ EOF
# parse binaries
_rwx_code_binaries="$(rwx_code_action_target "filter" "binary")"
# parse commands
_rwx_code_commands="$(rwx_code_parse "commands")"
_rwx_code_commands="$(rwx_code_action_target "filter" "command")"
# parse constants
_rwx_code_constants="$(rwx_code_action_target "filter" "constant" | sort)"
# parse functions