main/root
This commit is contained in:
parent
1de1cad1b3
commit
225dd1380b
3 changed files with 13 additions and 14 deletions
|
@ -8,14 +8,14 @@
|
||||||
|
|
||||||
# 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_MODULE}.${RWX_MAIN_EXTENSION}"
|
RWX_MAIN_PATH="${rwx_main_root}/${RWX_MAIN_MODULE}.${RWX_MAIN_EXTENSION}"
|
||||||
# user root directory of the project
|
# user root directory of the project
|
||||||
RWX_SELF_USER="${HOME}/${RWX_MAIN_NAME}"
|
RWX_SELF_USER="${HOME}/${RWX_MAIN_NAME}"
|
||||||
|
|
||||||
# cache of all sourced code modules
|
# cache of all sourced code modules
|
||||||
_rwx_code=""
|
_rwx_code=""
|
||||||
# cache for the parsing awk script
|
# 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
|
# cache for code aliases
|
||||||
_rwx_code_aliases=""
|
_rwx_code_aliases=""
|
||||||
# cache for code aliases functions
|
# cache for code aliases functions
|
||||||
|
@ -55,9 +55,9 @@ rwx_code_install() {
|
||||||
local command file name root
|
local command file name root
|
||||||
# code
|
# code
|
||||||
if [ -n "${target}" ]; then
|
if [ -n "${target}" ]; then
|
||||||
root="${target}${RWX_ROOT_SYSTEM}"
|
root="${target}${rwx_main_root}"
|
||||||
rwx_remove "${root}"
|
rwx_remove "${root}"
|
||||||
cp --recursive "${RWX_ROOT_SYSTEM}" "${root}"
|
cp --recursive "${rwx_main_root}" "${root}"
|
||||||
fi
|
fi
|
||||||
# commands
|
# commands
|
||||||
root="${target}/usr/local/bin"
|
root="${target}/usr/local/bin"
|
||||||
|
@ -164,10 +164,10 @@ rwx_code_variables() {
|
||||||
rwx_code_check() {
|
rwx_code_check() {
|
||||||
# check format
|
# check format
|
||||||
rwx_log
|
rwx_log
|
||||||
rwx_shfmt "${RWX_ROOT_SYSTEM}"
|
rwx_shfmt "${rwx_main_root}"
|
||||||
# check syntax
|
# check syntax
|
||||||
rwx_log
|
rwx_log
|
||||||
rwx_shellcheck "${RWX_ROOT_SYSTEM}"
|
rwx_shellcheck "${rwx_main_root}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# fetch matching doc for given name
|
# fetch matching doc for given name
|
||||||
|
@ -239,7 +239,7 @@ EOF
|
||||||
while IFS= read -r module; do
|
while IFS= read -r module; do
|
||||||
# cache main module
|
# cache main module
|
||||||
_rwx_code="${_rwx_code}#. ${module}
|
_rwx_code="${_rwx_code}#. ${module}
|
||||||
$(cat "${RWX_ROOT_SYSTEM}/${module}.${RWX_MAIN_EXTENSION}")
|
$(cat "${rwx_main_root}/${module}.${RWX_MAIN_EXTENSION}")
|
||||||
"
|
"
|
||||||
done <<EOF
|
done <<EOF
|
||||||
${modules_main}
|
${modules_main}
|
||||||
|
|
|
@ -21,9 +21,8 @@ RWX_MAIN_PARENT="/usr/local/lib"
|
||||||
# │ main │ variables │
|
# │ main │ variables │
|
||||||
# ╰──────┴───────────╯
|
# ╰──────┴───────────╯
|
||||||
|
|
||||||
# TODO variablize
|
|
||||||
# system root directory of the project
|
# system root directory of the project
|
||||||
RWX_ROOT_SYSTEM="${RWX_MAIN_PARENT}/${RWX_MAIN_NAME}"
|
rwx_main_root="${RWX_MAIN_PARENT}/${RWX_MAIN_NAME}"
|
||||||
|
|
||||||
# ╭──────┬──────╮
|
# ╭──────┬──────╮
|
||||||
# │ main │ find │
|
# │ main │ find │
|
||||||
|
@ -79,11 +78,11 @@ _rwx_main_log() {
|
||||||
rwx_main_main() {
|
rwx_main_main() {
|
||||||
local module modules
|
local module modules
|
||||||
# find & source modules
|
# find & source modules
|
||||||
modules="$(rwx_main_find "${RWX_ROOT_SYSTEM}")"
|
modules="$(rwx_main_find "${rwx_main_root}")"
|
||||||
while IFS= read -r module; do
|
while IFS= read -r module; do
|
||||||
if [ "${module}" != "${RWX_MAIN_MODULE}" ]; then
|
if [ "${module}" != "${RWX_MAIN_MODULE}" ]; then
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
. "${RWX_ROOT_SYSTEM}/${module}.${RWX_MAIN_EXTENSION}"
|
. "${rwx_main_root}/${module}.${RWX_MAIN_EXTENSION}"
|
||||||
fi
|
fi
|
||||||
done <<EOF
|
done <<EOF
|
||||||
${modules}
|
${modules}
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
rwx_self_subset() {
|
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_main_root}/${argument}"
|
||||||
file="${argument}.${RWX_MAIN_EXTENSION}"
|
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}.${RWX_MAIN_EXTENSION}"
|
echo "${argument}/${file}.${RWX_MAIN_EXTENSION}"
|
||||||
done
|
done
|
||||||
elif [ -f "${RWX_ROOT_SYSTEM}/${file}" ]; then
|
elif [ -f "${rwx_main_root}/${file}" ]; then
|
||||||
echo "${file}"
|
echo "${file}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -38,7 +38,7 @@ rwx_self_write() {
|
||||||
files="$(rwx_self_subset "${@}")"
|
files="$(rwx_self_subset "${@}")"
|
||||||
while IFS= read -r file; do
|
while IFS= read -r file; do
|
||||||
text="${text}
|
text="${text}
|
||||||
$(cat "${RWX_ROOT_SYSTEM}/${file}")
|
$(cat "${rwx_main_root}/${file}")
|
||||||
"
|
"
|
||||||
done <<EOF
|
done <<EOF
|
||||||
${files}
|
${files}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue