main/extension
All checks were successful
/ job (push) Successful in 2m57s

This commit is contained in:
Marc Beninca 2025-07-09 02:20:50 +02:00
parent 0593181f10
commit 99de96a393
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
4 changed files with 12 additions and 9 deletions

View file

@ -8,7 +8,7 @@
# TODO variablize # TODO variablize
# path to the entrypoint main file of the project # path to the entrypoint main file of the project
RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}.sh" RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}.${RWX_MAIN_EXTENSION}"
# user root directory of the project # user root directory of the project
RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}" RWX_SELF_USER="${HOME}/${RWX_SELF_NAME}"
@ -59,7 +59,7 @@ rwx_code_install() {
fi fi
# commands # commands
root="${target}/usr/local/bin" root="${target}/usr/local/bin"
name="${RWX_SELF_NAME}.sh" name="${RWX_SELF_NAME}.${RWX_MAIN_EXTENSION}"
file="${root}/${name}" file="${root}/${name}"
rwx_remove "${file}" rwx_remove "${file}"
rwx_link "${file}" "${RWX_MAIN_PATH}" rwx_link "${file}" "${RWX_MAIN_PATH}"
@ -71,7 +71,7 @@ rwx_code_install() {
${_rwx_code_commands} ${_rwx_code_commands}
EOF EOF
# sh # sh
file="${target}/etc/profile.d/${RWX_SELF_NAME}.sh" file="${target}/etc/profile.d/${RWX_SELF_NAME}.${RWX_MAIN_EXTENSION}"
rwx_remove "${file}" rwx_remove "${file}"
rwx_file_write "${file}" "\ rwx_file_write "${file}" "\
export ENV=\"${RWX_MAIN_PATH}\" export ENV=\"${RWX_MAIN_PATH}\"

View file

@ -4,7 +4,7 @@ rwx_shellcheck() {
file="$(mktemp)" file="$(mktemp)"
modules="$(rwx_main_find "${root}")" modules="$(rwx_main_find "${root}")"
while IFS= read -r module; do while IFS= read -r module; do
path="${root}/${module}.sh" path="${root}/${module}.${RWX_MAIN_EXTENSION}"
echo ". \"${path}\"" >>"${file}" echo ". \"${path}\"" >>"${file}"
done <<EOF done <<EOF
${modules} ${modules}

View file

@ -8,6 +8,9 @@
# │ main │ constants │ # │ main │ constants │
# ╰──────┴───────────╯ # ╰──────┴───────────╯
# extension of shell modules
RWX_MAIN_EXTENSION="sh"
# name of the entrypoint module # name of the entrypoint module
RWX_MAIN_NAME="main" RWX_MAIN_NAME="main"
# name of the project itself # name of the project itself
@ -36,7 +39,7 @@ rwx_main_find() {
local root="${1}" local root="${1}"
find \ find \
"${root}" \ "${root}" \
-name "*.sh" \ -name "*.${RWX_MAIN_EXTENSION}" \
-type "f" \ -type "f" \
-printf "%P\n" | -printf "%P\n" |
sed "s|\\.[^.]*\$||" | sed "s|\\.[^.]*\$||" |
@ -88,7 +91,7 @@ rwx_main_source() {
count=$((count + 1)) count=$((count + 1))
_rwx_main_log "$(printf "%02d" "${count}") ${module}" _rwx_main_log "$(printf "%02d" "${count}") ${module}"
# shellcheck disable=SC1090 # shellcheck disable=SC1090
. "${root}/${module}.sh" . "${root}/${module}.${RWX_MAIN_EXTENSION}"
# cache code # cache code
rwx_main_cache "${root}" "${module}" rwx_main_cache "${root}" "${module}"
fi fi
@ -107,7 +110,7 @@ EOF
rwx_main_cache() { rwx_main_cache() {
local root="${1}" local root="${1}"
local module="${2}" local module="${2}"
local path="${root}/${module}.sh" local path="${root}/${module}.${RWX_MAIN_EXTENSION}"
local text local text
text="$(cat "${path}")" text="$(cat "${path}")"
# all source code # all source code

View file

@ -11,11 +11,11 @@ rwx_self_subset() {
local argument file root local argument file root
for argument in "${@}"; do for argument in "${@}"; do
root="${RWX_ROOT_SYSTEM}/${argument}" root="${RWX_ROOT_SYSTEM}/${argument}"
file="${argument}.sh" file="${argument}.${RWX_MAIN_EXTENSION}"
if [ -d "${root}" ]; then if [ -d "${root}" ]; then
local file local file
for file in $(rwx_main_find "${root}"); do for file in $(rwx_main_find "${root}"); do
echo "${argument}/${file}.sh" echo "${argument}/${file}.${RWX_MAIN_EXTENSION}"
done done
elif [ -f "${RWX_ROOT_SYSTEM}/${file}" ]; then elif [ -f "${RWX_ROOT_SYSTEM}/${file}" ]; then
echo "${file}" echo "${file}"