From dd90da8a821281794e30fd82d1600e93723f29e7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 7 Jul 2025 05:48:43 +0200 Subject: [PATCH 01/16] shell/standalone --- sh/alias/shell.sh | 29 ------------------------- sh/main.sh | 3 --- sh/shell.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 32 deletions(-) delete mode 100644 sh/alias/shell.sh diff --git a/sh/alias/shell.sh b/sh/alias/shell.sh deleted file mode 100644 index d6f5801..0000000 --- a/sh/alias/shell.sh +++ /dev/null @@ -1,29 +0,0 @@ -# shorten alias -a() { - alias \ - "${@}" -} - -# swap directory (current ↔ previous) -sd() { - cd \ - - || - return -} - -# exit terminal -x() { - exit \ - "${@}" -} - -[ "${RWX_SHELL}" = "bash" ] || return - -# shellcheck disable=SC3033 -..() { - cd .. -} -# shellcheck disable=SC3033 -...() { - cd ../.. -} diff --git a/sh/main.sh b/sh/main.sh index 470cf72..16ce907 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -26,9 +26,6 @@ RWX_SELF_NAME="rwx" # │ main │ variables │ # ╰──────┴───────────╯ -# currently running shell name -RWX_SHELL="$(cat "/proc/${$}/comm")" - # system root directory of the project RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}" # user root directory of the project diff --git a/sh/shell.sh b/sh/shell.sh index 7e56658..8400fd2 100644 --- a/sh/shell.sh +++ b/sh/shell.sh @@ -1,3 +1,7 @@ +# ╭───────╮ +# │ shell │ +# ╰───────╯ + _rwx_shell_color() { local code="${1}" case "${RWX_SHELL}" in @@ -19,6 +23,11 @@ _rwx_shell_color() { ;; esac } + +# ╭───────┬───────────╮ +# │ shell │ constants │ +# ╰───────┴───────────╯ + RWX_COLOR_BROWN="$(_rwx_shell_color 33)" RWX_COLOR_CYAN="$(_rwx_shell_color 36)" RWX_COLOR_DEFAULT="$(_rwx_shell_color)" @@ -26,6 +35,17 @@ RWX_COLOR_GREEN="$(_rwx_shell_color 31)" RWX_COLOR_MAGENTA="$(_rwx_shell_color 35)" RWX_COLOR_RED="$(_rwx_shell_color 32)" +# ╭───────┬───────────╮ +# │ shell │ variables │ +# ╰───────┴───────────╯ + +# currently running shell name +RWX_SHELL="$(cat "/proc/${$}/comm")" + +# ╭───────┬───────────╮ +# │ shell │ functions │ +# ╰───────┴───────────╯ + rwx_shell_configure() { [ -n "${ENV}" ] || ENV="${RWX_MAIN_PATH}" export ENV @@ -114,3 +134,37 @@ rwx_shell_prompt() { # print printf "%b" "${view}" } + +# ╭───────┬───────────╮ +# │ shell │ shortcuts │ +# ╰───────┴───────────╯ + +# shorten alias +a() { + alias \ + "${@}" +} + +# swap directory (current ↔ previous) +sd() { + cd \ + - || + return +} + +# exit terminal +x() { + exit \ + "${@}" +} + +[ "${RWX_SHELL}" = "bash" ] || return + +# shellcheck disable=SC3033 +..() { + cd .. +} +# shellcheck disable=SC3033 +...() { + cd ../.. +} From a06bab3e976089aa283f9c1214f178ccaf369009 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 7 Jul 2025 21:38:07 +0200 Subject: [PATCH 02/16] shell/bash --- sh/alias/shell.sh | 11 ----------- sh/shell/bash.sh | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 sh/shell/bash.sh diff --git a/sh/alias/shell.sh b/sh/alias/shell.sh index d6f5801..f216c92 100644 --- a/sh/alias/shell.sh +++ b/sh/alias/shell.sh @@ -16,14 +16,3 @@ x() { exit \ "${@}" } - -[ "${RWX_SHELL}" = "bash" ] || return - -# shellcheck disable=SC3033 -..() { - cd .. -} -# shellcheck disable=SC3033 -...() { - cd ../.. -} diff --git a/sh/shell/bash.sh b/sh/shell/bash.sh new file mode 100644 index 0000000..627079b --- /dev/null +++ b/sh/shell/bash.sh @@ -0,0 +1,18 @@ +[ "${RWX_SHELL}" = "bash" ] || return + +# shellcheck disable=SC3033 +..() { + cd .. +} +# shellcheck disable=SC3033 +...() { + cd ../.. +} +# shellcheck disable=SC3033 +....() { + cd ../../.. +} +# shellcheck disable=SC3033 +.....() { + cd ../../../.. +} From ff5116380c7ac73a658ffd20b75639b46528a570 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 7 Jul 2025 21:43:48 +0200 Subject: [PATCH 03/16] bash/if --- sh/shell/bash.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sh/shell/bash.sh b/sh/shell/bash.sh index 627079b..400f83c 100644 --- a/sh/shell/bash.sh +++ b/sh/shell/bash.sh @@ -1,4 +1,8 @@ -[ "${RWX_SHELL}" = "bash" ] || return +# ╭───────┬──────╮ +# │ shell │ bash │ +# ╰───────┴──────╯ + +if [ "${RWX_SHELL}" = "bash" ]; then # shellcheck disable=SC3033 ..() { @@ -16,3 +20,5 @@ .....() { cd ../../../.. } + +fi From efe07205fa95376a26f16df3a78ab639aa42e0bc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 7 Jul 2025 21:50:34 +0200 Subject: [PATCH 04/16] shell/0 --- sh/{shell.sh => shell/0.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{shell.sh => shell/0.sh} (100%) diff --git a/sh/shell.sh b/sh/shell/0.sh similarity index 100% rename from sh/shell.sh rename to sh/shell/0.sh From aec3d1a0afe49b5065e75040e2be11aec7076876 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 7 Jul 2025 21:55:01 +0200 Subject: [PATCH 05/16] shell/main --- sh/shell/0.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sh/shell/0.sh b/sh/shell/0.sh index 7e56658..6a28c31 100644 --- a/sh/shell/0.sh +++ b/sh/shell/0.sh @@ -1,3 +1,7 @@ +# ╭───────╮ +# │ shell │ +# ╰───────╯ + _rwx_shell_color() { local code="${1}" case "${RWX_SHELL}" in @@ -19,6 +23,11 @@ _rwx_shell_color() { ;; esac } + +# ╭───────┬───────────╮ +# │ shell │ constants │ +# ╰───────┴───────────╯ + RWX_COLOR_BROWN="$(_rwx_shell_color 33)" RWX_COLOR_CYAN="$(_rwx_shell_color 36)" RWX_COLOR_DEFAULT="$(_rwx_shell_color)" @@ -26,6 +35,10 @@ RWX_COLOR_GREEN="$(_rwx_shell_color 31)" RWX_COLOR_MAGENTA="$(_rwx_shell_color 35)" RWX_COLOR_RED="$(_rwx_shell_color 32)" +# ╭───────┬───────────╮ +# │ shell │ functions │ +# ╰───────┴───────────╯ + rwx_shell_configure() { [ -n "${ENV}" ] || ENV="${RWX_MAIN_PATH}" export ENV @@ -60,7 +73,6 @@ rwx_shell_configure() { *) ;; esac } -rwx_shell_configure rwx_shell_prompt() { local date host id @@ -114,3 +126,13 @@ rwx_shell_prompt() { # print printf "%b" "${view}" } + +# ╭───────┬──────╮ +# │ shell │ main │ +# ╰───────┴──────╯ + +rwx_shell_main() { + rwx_shell_configure +} + +rwx_shell_main From 24a931cbfc884e873d5f25068155b7c658f6e361 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 7 Jul 2025 23:38:09 +0200 Subject: [PATCH 06/16] shell/mv --- sh/main.sh | 3 --- sh/shell/0.sh | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 470cf72..16ce907 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -26,9 +26,6 @@ RWX_SELF_NAME="rwx" # │ main │ variables │ # ╰──────┴───────────╯ -# currently running shell name -RWX_SHELL="$(cat "/proc/${$}/comm")" - # system root directory of the project RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}" # user root directory of the project diff --git a/sh/shell/0.sh b/sh/shell/0.sh index 6a28c31..c52639b 100644 --- a/sh/shell/0.sh +++ b/sh/shell/0.sh @@ -2,6 +2,9 @@ # │ shell │ # ╰───────╯ +# currently running shell name +RWX_SHELL="$(cat "/proc/${$}/comm")" + _rwx_shell_color() { local code="${1}" case "${RWX_SHELL}" in From 51cb88d0d3d77514ca8cdf3d2093c21c78fea6ad Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 7 Jul 2025 23:44:45 +0200 Subject: [PATCH 07/16] shell/shortcuts --- sh/alias/shell.sh | 18 ------------------ sh/shell/0.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 18 deletions(-) delete mode 100644 sh/alias/shell.sh diff --git a/sh/alias/shell.sh b/sh/alias/shell.sh deleted file mode 100644 index f216c92..0000000 --- a/sh/alias/shell.sh +++ /dev/null @@ -1,18 +0,0 @@ -# shorten alias -a() { - alias \ - "${@}" -} - -# swap directory (current ↔ previous) -sd() { - cd \ - - || - return -} - -# exit terminal -x() { - exit \ - "${@}" -} diff --git a/sh/shell/0.sh b/sh/shell/0.sh index c52639b..ed847cb 100644 --- a/sh/shell/0.sh +++ b/sh/shell/0.sh @@ -130,6 +130,32 @@ rwx_shell_prompt() { printf "%b" "${view}" } +# ╭───────┬───────────╮ +# │ shell │ shortcuts │ +# ╰───────┴───────────╯ + +# shorten alias +#= a +rwx_shell_alias() { + alias \ + "${@}" +} + +# swap directory (current ↔ previous) +#= sd +rwx_shell_swap_directory() { + cd \ + - || + return +} + +# exit terminal +#= x +rwx_shell_exit() { + exit \ + "${@}" +} + # ╭───────┬──────╮ # │ shell │ main │ # ╰───────┴──────╯ From cc1f8f816abbddb78dd957259404f342e3fbe4c3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 8 Jul 2025 00:05:07 +0200 Subject: [PATCH 08/16] code/commands --- sh/code.awk | 10 ++++++++++ sh/code.sh | 13 +++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) 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 < Date: Tue, 8 Jul 2025 00:44:25 +0200 Subject: [PATCH 09/16] rwx/code --- sh/main.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 16ce907..9d79661 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -26,6 +26,9 @@ RWX_SELF_NAME="rwx" # │ main │ variables │ # ╰──────┴───────────╯ +# cache of all sourced code modules +_rwx_code="" + # system root directory of the project RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}" # user root directory of the project @@ -77,9 +80,6 @@ rwx_main() { # │ main │ cache │ # ╰──────┴───────╯ -# cache of all sourced code modules -_rwx_code="" - # cache source code of a module # inside a global code variable rwx_cache() { From cd1701fb7159aae79cc5428d9a5538aa7feabc62 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 8 Jul 2025 00:48:18 +0200 Subject: [PATCH 10/16] main/main,cache --- sh/main.sh | 120 +++++++++++++++++++++++++++-------------------------- 1 file changed, 61 insertions(+), 59 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 9d79661..dd3628c 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -37,65 +37,6 @@ RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}" # path to the entrypoint main file of the project RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}" -# ╭──────┬──────╮ -# │ main │ main │ -# ╰──────┴──────╯ - -# run initial steps -rwx_main() { - # cache main - rwx_cache "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}" - # source system root - if ! rwx_source "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"; then - __rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}" - return 1 - fi - # source user root - rwx_source "${RWX_SELF_USER}" - # load code cache - rwx_code_load - # context / command - local command - # command name used to run - # (stripped from hyphen interactive flag) - command="$(basename "${0}" | sed "s|^-||")" - case "${command}" in - "bash" | "dash" | "sh") unset command ;; - *) ;; - esac - if [ -n "${command}" ]; then - local function - # find the matching function - function="$(rwx_code_alias_function "${command}")" - if [ -n "${function}" ]; then - "${function}" "${@}" - fi - # context / shell - else - rwx_self_init - fi -} - -# ╭──────┬───────╮ -# │ main │ cache │ -# ╰──────┴───────╯ - -# cache source code of a module -# inside a global code variable -rwx_cache() { - local root="${1}" - local module="${2}" - local name="${module%.sh}" - local path="${root}/${module}" - local text - text="$(cat "${path}")" - # all source code - _rwx_code="${_rwx_code}\ -#. ${name} -${text} -" -} - # ╭──────┬────────╮ # │ main │ source │ # ╰──────┴────────╯ @@ -176,6 +117,67 @@ rwx_find_shell() { rwx_find_extension "sh" "${@}" } +################################################################################ + +# ╭──────┬───────╮ +# │ main │ cache │ +# ╰──────┴───────╯ + +# cache source code of a module +# inside a global code variable +rwx_cache() { + local root="${1}" + local module="${2}" + local name="${module%.sh}" + local path="${root}/${module}" + local text + text="$(cat "${path}")" + # all source code + _rwx_code="${_rwx_code}\ +#. ${name} +${text} +" +} + +# ╭──────┬──────╮ +# │ main │ main │ +# ╰──────┴──────╯ + +# run initial steps +rwx_main() { + # cache main + rwx_cache "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}" + # source system root + if ! rwx_source "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"; then + __rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}" + return 1 + fi + # source user root + rwx_source "${RWX_SELF_USER}" + # load code cache + rwx_code_load + # context / command + local command + # command name used to run + # (stripped from hyphen interactive flag) + command="$(basename "${0}" | sed "s|^-||")" + case "${command}" in + "bash" | "dash" | "sh") unset command ;; + *) ;; + esac + if [ -n "${command}" ]; then + local function + # find the matching function + function="$(rwx_code_alias_function "${command}")" + if [ -n "${function}" ]; then + "${function}" "${@}" + fi + # context / shell + else + rwx_self_init + fi +} + # ╭──────┬─────╮ # │ main │ run │ # ╰──────┴─────╯ From b342a2c9e17ed1e9ae2366d779cd605a37033b35 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 8 Jul 2025 01:12:02 +0200 Subject: [PATCH 11/16] main/source --- sh/main.sh | 55 +++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index dd3628c..0476b0b 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -37,33 +37,6 @@ RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}" # path to the entrypoint main file of the project RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}" -# ╭──────┬────────╮ -# │ main │ source │ -# ╰──────┴────────╯ - -# source code from file path -rwx_source() { - local root="${1}" - [ -d "${root}" ] || - return 1 - local file="${2}" - local count module modules - count=0 - __rwx_log "" \ - ". ${root}" - modules="$(rwx_find_shell "${root}" "${file}")" - while IFS= read -r module; do - count=$((count + 1)) - __rwx_log "$(printf "%02d" "${count}") ${module%.sh}" - # shellcheck disable=SC1090 - . "${root}/${module}" - # cache code - rwx_cache "${root}" "${module}" - done < cat rwx_cache() { local root="${1}" local module="${2}" From 19249747c0b88dc0f1757a483387b12d72ac2cd1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 8 Jul 2025 01:13:06 +0200 Subject: [PATCH 12/16] main/log --- sh/main.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 0476b0b..b368970 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -37,20 +37,6 @@ RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}" # path to the entrypoint main file of the project RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}" -# ╭──────┬─────╮ -# │ main │ log │ -# ╰──────┴─────╯ - -__rwx_log() { - if rwx_shell_interactive; then - [ ${#} -gt 0 ] || set -- "" - local line - for line in "${@}"; do - echo "${line}" - done - fi -} - # ╭──────┬───────╮ # │ main │ shell │ # ╰──────┴───────╯ @@ -92,6 +78,20 @@ rwx_find_shell() { ################################################################################ +# ╭──────┬─────╮ +# │ main │ log │ +# ╰──────┴─────╯ + +__rwx_log() { + if rwx_shell_interactive; then + [ ${#} -gt 0 ] || set -- "" + local line + for line in "${@}"; do + echo "${line}" + done + fi +} + # ╭──────┬────────╮ # │ main │ source │ # ╰──────┴────────╯ From aadfe212c2e4d4ecbf52464f1c15064939ccae18 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 8 Jul 2025 01:15:21 +0200 Subject: [PATCH 13/16] main/shell --- sh/main.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index b368970..6a70831 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -37,18 +37,6 @@ RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}" # path to the entrypoint main file of the project RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}" -# ╭──────┬───────╮ -# │ main │ shell │ -# ╰──────┴───────╯ - -# test if active shell is in interactive mode -rwx_shell_interactive() { - case "${-}" in - *i*) ;; - *) return 1 ;; - esac -} - # ╭──────┬──────╮ # │ main │ find │ # ╰──────┴──────╯ @@ -78,6 +66,18 @@ rwx_find_shell() { ################################################################################ +# ╭──────┬───────╮ +# │ main │ shell │ +# ╰──────┴───────╯ + +# test if active shell is in interactive mode +rwx_shell_interactive() { + case "${-}" in + *i*) ;; + *) return 1 ;; + esac +} + # ╭──────┬─────╮ # │ main │ log │ # ╰──────┴─────╯ From ff3716148a8e1a0c5e180ecaae1fbd13e4d9422a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 8 Jul 2025 01:20:36 +0200 Subject: [PATCH 14/16] find,sort --- sh/main.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 6a70831..62a5bfc 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -42,6 +42,8 @@ RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}" # ╰──────┴──────╯ # find directory’s files by extension +#> find +#> sort rwx_find_extension() { local extension="${1}" local root="${2}" @@ -64,8 +66,6 @@ rwx_find_shell() { rwx_find_extension "sh" "${@}" } -################################################################################ - # ╭──────┬───────╮ # │ main │ shell │ # ╰──────┴───────╯ From b45449421e3a22cc600366f10a9ca1f2e525f288 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 8 Jul 2025 01:25:22 +0200 Subject: [PATCH 15/16] test/commands --- sh/test.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sh/test.sh b/sh/test.sh index 4f4a557..ad17c22 100644 --- a/sh/test.sh +++ b/sh/test.sh @@ -21,7 +21,8 @@ rwx_test_code() { "variables" \ "functions" \ "aliases" \ - "aliases_functions" + "aliases_functions" \ + "commands" rwx_code for items in "${@}"; do echo @@ -46,7 +47,9 @@ rwx_test_doc() { "rwx_cache" \ \ "alias/batcat" \ - "b" + "b" \ + \ + "rwx_install" for item in "${@}"; do echo rwx_code_doc "${item}" From 091c9339f70b428eab746f315648c9e099ef7473 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 8 Jul 2025 01:43:30 +0200 Subject: [PATCH 16/16] code/command --- sh/code.awk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sh/code.awk b/sh/code.awk index efada06..fba6da4 100644 --- a/sh/code.awk +++ b/sh/code.awk @@ -41,6 +41,7 @@ BEGIN { RE_VARIABLE = RE_BEGIN RE_VAR RE_SET RE_END alias = 0 + command = 0 f = "" reset() module = 0 @@ -97,7 +98,7 @@ BEGIN { } else if (match($0, RE_COMMAND, m)) { append("/ " m[1]) if (m[1] == target) { - alias = 1 + command = 1 } # set } else if (match($0, RE_CONSTANT, m)) { @@ -124,6 +125,9 @@ BEGIN { if (alias) { print "= " target output(f, "function") + } else if (command) { + print "/ " target + output(f, "function") } else if (f == target) { output(f, "function") } else {