From 189b4f521ddca617b25a0a67ab0ec20f3f81c425 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 9 Jul 2025 16:13:16 +0200 Subject: [PATCH 1/7] main/module --- sh/core/code.sh | 2 +- sh/main.sh | 6 +++--- sh/test.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sh/core/code.sh b/sh/core/code.sh index 3d65f5c..a5037ec 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -8,7 +8,7 @@ # TODO variablize # path to the entrypoint main file of the project -RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}.${RWX_MAIN_EXTENSION}" +RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_MODULE}.${RWX_MAIN_EXTENSION}" # user root directory of the project RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}" diff --git a/sh/main.sh b/sh/main.sh index 6a3a3d3..e648c1a 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -10,9 +10,9 @@ # extension of shell modules RWX_MAIN_EXTENSION="sh" - # name of the entrypoint module -RWX_MAIN_NAME="main" +RWX_MAIN_MODULE="main" + # name of the project itself RWX_SELF_NAME="rwx" @@ -80,7 +80,7 @@ rwx_main_main() { # find & source modules modules="$(rwx_main_find "${RWX_ROOT_SYSTEM}")" while IFS= read -r module; do - if [ "${module}" != "${RWX_MAIN_NAME}" ]; then + if [ "${module}" != "${RWX_MAIN_MODULE}" ]; then # shellcheck disable=SC1090 . "${RWX_ROOT_SYSTEM}/${module}.${RWX_MAIN_EXTENSION}" fi diff --git a/sh/test.sh b/sh/test.sh index 1b082b5..1ef31ec 100644 --- a/sh/test.sh +++ b/sh/test.sh @@ -41,7 +41,7 @@ rwx_test_doc() { "main" \ "alias/git" \ \ - "RWX_MAIN_NAME" \ + "RWX_MAIN_MODULE" \ \ "_rwx_code" \ \ From 1bf5581936da987248ba708cbeaa08343fd67f4f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 9 Jul 2025 16:15:42 +0200 Subject: [PATCH 2/7] main/name --- sh/core/code.sh | 6 +++--- sh/main.sh | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sh/core/code.sh b/sh/core/code.sh index a5037ec..fd943bc 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -10,7 +10,7 @@ # path to the entrypoint main file of the project RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_MODULE}.${RWX_MAIN_EXTENSION}" # user root directory of the project -RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}" +RWX_SELF_USER="${HOME}/${RWX_MAIN_NAME}" # cache of all sourced code modules _rwx_code="" @@ -61,7 +61,7 @@ rwx_code_install() { fi # commands root="${target}/usr/local/bin" - name="${RWX_SELF_NAME}.${RWX_MAIN_EXTENSION}" + name="${RWX_MAIN_NAME}.${RWX_MAIN_EXTENSION}" file="${root}/${name}" rwx_remove "${file}" rwx_link "${file}" "${RWX_MAIN_PATH}" @@ -73,7 +73,7 @@ rwx_code_install() { ${_rwx_code_commands} EOF # sh - file="${target}/etc/profile.d/${RWX_SELF_NAME}.${RWX_MAIN_EXTENSION}" + file="${target}/etc/profile.d/${RWX_MAIN_NAME}.${RWX_MAIN_EXTENSION}" rwx_remove "${file}" rwx_file_write "${file}" "\ export ENV=\"${RWX_MAIN_PATH}\" diff --git a/sh/main.sh b/sh/main.sh index e648c1a..7b06423 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -12,9 +12,8 @@ RWX_MAIN_EXTENSION="sh" # name of the entrypoint module RWX_MAIN_MODULE="main" - # name of the project itself -RWX_SELF_NAME="rwx" +RWX_MAIN_NAME="rwx" # ╭──────┬───────────╮ # │ main │ variables │ @@ -22,7 +21,7 @@ RWX_SELF_NAME="rwx" # TODO variablize # system root directory of the project -RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}" +RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_MAIN_NAME}" # ╭──────┬──────╮ # │ main │ find │ From 1de1cad1b32fc7e146892ae6d8618bbd4ea6c336 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 9 Jul 2025 16:23:27 +0200 Subject: [PATCH 3/7] main/parent --- sh/main.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sh/main.sh b/sh/main.sh index 7b06423..5451da5 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -14,6 +14,8 @@ RWX_MAIN_EXTENSION="sh" RWX_MAIN_MODULE="main" # name of the project itself RWX_MAIN_NAME="rwx" +# parent directory for the project +RWX_MAIN_PARENT="/usr/local/lib" # ╭──────┬───────────╮ # │ main │ variables │ @@ -21,7 +23,7 @@ RWX_MAIN_NAME="rwx" # TODO variablize # system root directory of the project -RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_MAIN_NAME}" +RWX_ROOT_SYSTEM="${RWX_MAIN_PARENT}/${RWX_MAIN_NAME}" # ╭──────┬──────╮ # │ main │ find │ From 225dd1380b9857b5cb5f618f99854632e4a27275 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 9 Jul 2025 16:35:11 +0200 Subject: [PATCH 4/7] main/root --- sh/core/code.sh | 14 +++++++------- sh/main.sh | 7 +++---- sh/self.sh | 6 +++--- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/sh/core/code.sh b/sh/core/code.sh index fd943bc..198112d 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -8,14 +8,14 @@ # TODO variablize # path to the entrypoint main file of the project -RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_MODULE}.${RWX_MAIN_EXTENSION}" +RWX_MAIN_PATH="${rwx_main_root}/${RWX_MAIN_MODULE}.${RWX_MAIN_EXTENSION}" # user root directory of the project RWX_SELF_USER="${HOME}/${RWX_MAIN_NAME}" # cache of all sourced code modules _rwx_code="" # cache for the parsing awk script -_rwx_code_awk="$(cat "${RWX_ROOT_SYSTEM}/core/code.awk")" +_rwx_code_awk="$(cat "${rwx_main_root}/core/code.awk")" # cache for code aliases _rwx_code_aliases="" # cache for code aliases functions @@ -55,9 +55,9 @@ rwx_code_install() { local command file name root # code if [ -n "${target}" ]; then - root="${target}${RWX_ROOT_SYSTEM}" + root="${target}${rwx_main_root}" rwx_remove "${root}" - cp --recursive "${RWX_ROOT_SYSTEM}" "${root}" + cp --recursive "${rwx_main_root}" "${root}" fi # commands root="${target}/usr/local/bin" @@ -164,10 +164,10 @@ rwx_code_variables() { rwx_code_check() { # check format rwx_log - rwx_shfmt "${RWX_ROOT_SYSTEM}" + rwx_shfmt "${rwx_main_root}" # check syntax rwx_log - rwx_shellcheck "${RWX_ROOT_SYSTEM}" + rwx_shellcheck "${rwx_main_root}" } # fetch matching doc for given name @@ -239,7 +239,7 @@ EOF while IFS= read -r module; do # cache main module _rwx_code="${_rwx_code}#. ${module} -$(cat "${RWX_ROOT_SYSTEM}/${module}.${RWX_MAIN_EXTENSION}") +$(cat "${rwx_main_root}/${module}.${RWX_MAIN_EXTENSION}") " done < Date: Wed, 9 Jul 2025 16:42:08 +0200 Subject: [PATCH 5/7] =?UTF-8?q?main/=E2=86=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sh/main.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 847227a..3aa62c2 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -8,14 +8,14 @@ # │ main │ constants │ # ╰──────┴───────────╯ -# extension of shell modules -RWX_MAIN_EXTENSION="sh" -# name of the entrypoint module -RWX_MAIN_MODULE="main" -# name of the project itself -RWX_MAIN_NAME="rwx" # parent directory for the project RWX_MAIN_PARENT="/usr/local/lib" +# name of the project itself +RWX_MAIN_NAME="rwx" +# name of the entrypoint module +RWX_MAIN_MODULE="main" +# extension of shell modules +RWX_MAIN_EXTENSION="sh" # ╭──────┬───────────╮ # │ main │ variables │ From 1e40941856aac26d7ec163e732d37da7b40c25bf Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 9 Jul 2025 17:05:34 +0200 Subject: [PATCH 6/7] code/main --- sh/core/code.sh | 6 +++--- sh/shell/0.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sh/core/code.sh b/sh/core/code.sh index 198112d..a11f6cc 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -64,7 +64,7 @@ rwx_code_install() { name="${RWX_MAIN_NAME}.${RWX_MAIN_EXTENSION}" file="${root}/${name}" rwx_remove "${file}" - rwx_link "${file}" "${RWX_MAIN_PATH}" + rwx_link "${file}" "${rwx_code_main}" while IFS= read -r command; do file="${root}/${command}" rwx_remove "${file}" @@ -76,12 +76,12 @@ EOF file="${target}/etc/profile.d/${RWX_MAIN_NAME}.${RWX_MAIN_EXTENSION}" rwx_remove "${file}" rwx_file_write "${file}" "\ -export ENV=\"${RWX_MAIN_PATH}\" +export ENV=\"${rwx_code_main}\" " # bash file="${target}/etc/bash.bashrc" rwx_remove "${file}" - rwx_link "${file}" "${RWX_MAIN_PATH}" + rwx_link "${file}" "${rwx_code_main}" } # ╭──────┬───────╮ diff --git a/sh/shell/0.sh b/sh/shell/0.sh index ed847cb..92d5aaa 100644 --- a/sh/shell/0.sh +++ b/sh/shell/0.sh @@ -43,7 +43,7 @@ RWX_COLOR_RED="$(_rwx_shell_color 32)" # ╰───────┴───────────╯ rwx_shell_configure() { - [ -n "${ENV}" ] || ENV="${RWX_MAIN_PATH}" + [ -n "${ENV}" ] || ENV="${rwx_code_main}" export ENV # prompt PS1="\$(rwx_shell_prompt \${?})" From 333da5fb6a4f1de4eb2f57d8f5be26d6f96f57b0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 9 Jul 2025 17:16:00 +0200 Subject: [PATCH 7/7] code/root --- sh/core/code.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sh/core/code.sh b/sh/core/code.sh index a11f6cc..af9962f 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -6,11 +6,10 @@ # │ code │ variables │ # ╰──────┴───────────╯ -# TODO variablize # path to the entrypoint main file of the project -RWX_MAIN_PATH="${rwx_main_root}/${RWX_MAIN_MODULE}.${RWX_MAIN_EXTENSION}" +rwx_code_main="${rwx_main_root}/${RWX_MAIN_MODULE}.${RWX_MAIN_EXTENSION}" # user root directory of the project -RWX_SELF_USER="${HOME}/${RWX_MAIN_NAME}" +rwx_code_root="${HOME}/${RWX_MAIN_NAME}" # cache of all sourced code modules _rwx_code="" @@ -228,10 +227,10 @@ rwx_code_main() { local modules_main="${1}" local module modules_user # find & source modules - modules_user="$(rwx_main_find "${RWX_SELF_USER}")" + modules_user="$(rwx_main_find "${rwx_code_root}")" while IFS= read -r module; do # shellcheck disable=SC1090 - . "${RWX_SELF_USER}/${module}.${RWX_MAIN_EXTENSION}" + . "${rwx_code_root}/${module}.${RWX_MAIN_EXTENSION}" done <