diff --git a/sh/core/code.sh b/sh/core/code.sh index 3d65f5c..af9962f 100644 --- a/sh/core/code.sh +++ b/sh/core/code.sh @@ -6,16 +6,15 @@ # │ code │ variables │ # ╰──────┴───────────╯ -# TODO variablize # path to the entrypoint main file of the project -RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}.${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_SELF_NAME}" +rwx_code_root="${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,16 +54,16 @@ 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" - 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}" + rwx_link "${file}" "${rwx_code_main}" while IFS= read -r command; do file="${root}/${command}" rwx_remove "${file}" @@ -73,15 +72,15 @@ 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}\" +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}" } # ╭──────┬───────╮ @@ -164,10 +163,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 @@ -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 <