From 148a9aef966bb1a5125a188d1ae26e015e284158 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 11 Jul 2025 23:34:46 +0200 Subject: [PATCH] code/commands --- sh/core/code.awk | 12 ++++-------- sh/core/code.sh | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/sh/core/code.awk b/sh/core/code.awk index 3ed41ed..89d0816 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -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 diff --git a/sh/core/code.sh b/sh/core/code.sh index e88963c..6ea16c5 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -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