diff --git a/sh/code.awk b/sh/code.awk index 0d23127..efada06 100644 --- a/sh/code.awk +++ b/sh/code.awk @@ -32,6 +32,7 @@ BEGIN { RE_ALIAS = 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_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 @@ -50,6 +51,10 @@ BEGIN { if (match($0, RE_ALIAS, m)) { print m[1] } + } else if (action == "commands") { + if (match($0, RE_COMMAND, m)) { + print m[1] + } } else if (action == "constants") { if (match($0, RE_CONSTANT, m)) { print m[1] @@ -89,6 +94,11 @@ BEGIN { if (m[1] == target) { alias = 1 } + } else if (match($0, RE_COMMAND, m)) { + append("/ " m[1]) + if (m[1] == target) { + alias = 1 + } # set } else if (match($0, RE_CONSTANT, m)) { if (m[1] == target) { diff --git a/sh/code.sh b/sh/code.sh index 76487b9..de4b331 100644 --- a/sh/code.sh +++ b/sh/code.sh @@ -12,6 +12,8 @@ _rwx_code_awk="$(cat "${RWX_ROOT_SYSTEM}/code.awk")" _rwx_code_aliases="" # cache for code aliases functions _rwx_code_aliases_functions="" +# cache for code commands +_rwx_code_commands="" # cache for code constants _rwx_code_constants="" # cache for code functions @@ -23,7 +25,7 @@ _rwx_code_variables="" # │ code │ install │ # ╰──────┴─────────╯ -#= rwx_install +#/ rwx_install rwx_code_install() { local target="${1}" local command file name root @@ -44,7 +46,7 @@ rwx_code_install() { rwx_remove "${file}" rwx_link "${file}" "${name}" done <