Compare commits
4 commits
7a8915682d
...
13ab4b8ec7
Author | SHA1 | Date | |
---|---|---|---|
13ab4b8ec7 | |||
bfcfde3520 | |||
af31b433ac | |||
de82ed02dc |
4 changed files with 56 additions and 13 deletions
|
@ -6,8 +6,10 @@
|
||||||
# │ code │ variables │
|
# │ code │ variables │
|
||||||
# ╰──────┴───────────╯
|
# ╰──────┴───────────╯
|
||||||
|
|
||||||
# path to the entrypoint main file of the project
|
# main modules names
|
||||||
rwx_code_main="${rwx_main_root}/${RWX_MAIN_MODULE}.${RWX_MAIN_EXTENSION}"
|
rwx_code_modules_main=""
|
||||||
|
# user modules names
|
||||||
|
rwx_code_modules_user=""
|
||||||
# user root directory of the project
|
# user root directory of the project
|
||||||
rwx_code_root="${HOME}/${RWX_MAIN_NAME}"
|
rwx_code_root="${HOME}/${RWX_MAIN_NAME}"
|
||||||
|
|
||||||
|
@ -63,7 +65,7 @@ rwx_code_install() {
|
||||||
name="${RWX_MAIN_NAME}.${RWX_MAIN_EXTENSION}"
|
name="${RWX_MAIN_NAME}.${RWX_MAIN_EXTENSION}"
|
||||||
file="${root}/${name}"
|
file="${root}/${name}"
|
||||||
rwx_remove "${file}"
|
rwx_remove "${file}"
|
||||||
rwx_link "${file}" "${rwx_code_main}"
|
rwx_link "${file}" "${rwx_main_path}"
|
||||||
while IFS= read -r command; do
|
while IFS= read -r command; do
|
||||||
file="${root}/${command}"
|
file="${root}/${command}"
|
||||||
rwx_remove "${file}"
|
rwx_remove "${file}"
|
||||||
|
@ -75,12 +77,12 @@ EOF
|
||||||
file="${target}/etc/profile.d/${RWX_MAIN_NAME}.${RWX_MAIN_EXTENSION}"
|
file="${target}/etc/profile.d/${RWX_MAIN_NAME}.${RWX_MAIN_EXTENSION}"
|
||||||
rwx_remove "${file}"
|
rwx_remove "${file}"
|
||||||
rwx_file_write "${file}" "\
|
rwx_file_write "${file}" "\
|
||||||
export ENV=\"${rwx_code_main}\"
|
export ENV=\"${rwx_main_path}\"
|
||||||
"
|
"
|
||||||
# bash
|
# bash
|
||||||
file="${target}/etc/bash.bashrc"
|
file="${target}/etc/bash.bashrc"
|
||||||
rwx_remove "${file}"
|
rwx_remove "${file}"
|
||||||
rwx_link "${file}" "${rwx_code_main}"
|
rwx_link "${file}" "${rwx_main_path}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ╭──────┬───────╮
|
# ╭──────┬───────╮
|
||||||
|
@ -149,6 +151,25 @@ rwx_code_functions() {
|
||||||
echo "${_rwx_code_functions}"
|
echo "${_rwx_code_functions}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# show all the cached main modules
|
||||||
|
#= rcm
|
||||||
|
rwx_code_modules() {
|
||||||
|
rwx_code_modules_main
|
||||||
|
rwx_code_modules_user
|
||||||
|
}
|
||||||
|
|
||||||
|
# show the cached main modules
|
||||||
|
#= rcmm
|
||||||
|
rwx_code_modules_main() {
|
||||||
|
echo "${rwx_code_modules_main}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# show the cached user modules
|
||||||
|
#= rcmu
|
||||||
|
rwx_code_modules_user() {
|
||||||
|
echo "${rwx_code_modules_user}"
|
||||||
|
}
|
||||||
|
|
||||||
# show the cached variables
|
# show the cached variables
|
||||||
#= rcv
|
#= rcv
|
||||||
rwx_code_variables() {
|
rwx_code_variables() {
|
||||||
|
@ -225,14 +246,16 @@ rwx_code_parse() {
|
||||||
|
|
||||||
rwx_code_main() {
|
rwx_code_main() {
|
||||||
local modules_main="${1}"
|
local modules_main="${1}"
|
||||||
local module modules_user
|
local module
|
||||||
# find & source modules
|
rwx_code_modules_main="${modules_main}"
|
||||||
modules_user="$(rwx_main_find "${rwx_code_root}")"
|
# find user modules
|
||||||
|
rwx_code_modules_user="$(rwx_main_find "${rwx_code_root}")"
|
||||||
|
# source user modules
|
||||||
while IFS= read -r module; do
|
while IFS= read -r module; do
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
. "${rwx_code_root}/${module}.${RWX_MAIN_EXTENSION}"
|
. "${rwx_code_root}/${module}.${RWX_MAIN_EXTENSION}"
|
||||||
done <<EOF
|
done <<EOF
|
||||||
${modules_user}
|
${rwx_code_modules_user}
|
||||||
EOF
|
EOF
|
||||||
# cache main modules
|
# cache main modules
|
||||||
while IFS= read -r module; do
|
while IFS= read -r module; do
|
||||||
|
@ -243,14 +266,14 @@ $(cat "${rwx_main_root}/${module}.${RWX_MAIN_EXTENSION}")
|
||||||
done <<EOF
|
done <<EOF
|
||||||
${modules_main}
|
${modules_main}
|
||||||
EOF
|
EOF
|
||||||
# cache modules
|
# cache user modules
|
||||||
while IFS= read -r module; do
|
while IFS= read -r module; do
|
||||||
# cache module
|
# cache user module
|
||||||
_rwx_code="${_rwx_code}#. ${module}
|
_rwx_code="${_rwx_code}#. ${module}
|
||||||
$(cat "${rwx_code_root}/${module}.${RWX_MAIN_EXTENSION}")
|
$(cat "${rwx_code_root}/${module}.${RWX_MAIN_EXTENSION}")
|
||||||
"
|
"
|
||||||
done <<EOF
|
done <<EOF
|
||||||
${modules_user}
|
${rwx_code_modules_user}
|
||||||
EOF
|
EOF
|
||||||
# load code cache
|
# load code cache
|
||||||
rwx_code_load
|
rwx_code_load
|
||||||
|
|
|
@ -22,6 +22,11 @@ RWX_MAIN_EXTENSION="sh"
|
||||||
|
|
||||||
# project main root directory
|
# project main root directory
|
||||||
rwx_main_root="${RWX_MAIN_PARENT}/${RWX_MAIN_NAME}"
|
rwx_main_root="${RWX_MAIN_PARENT}/${RWX_MAIN_NAME}"
|
||||||
|
# project main entrypoint file
|
||||||
|
rwx_main_file="${RWX_MAIN_MODULE}/${RWX_MAIN_EXTENSION}"
|
||||||
|
|
||||||
|
# path to the entrypoint main file of the project
|
||||||
|
rwx_main_path="${rwx_main_root}/${rwx_main_file}"
|
||||||
|
|
||||||
# ╭──────┬──────╮
|
# ╭──────┬──────╮
|
||||||
# │ main │ find │
|
# │ main │ find │
|
||||||
|
|
|
@ -55,7 +55,7 @@ rwx_shell_interactive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
rwx_shell_configure() {
|
rwx_shell_configure() {
|
||||||
[ -n "${ENV}" ] || ENV="${rwx_code_main}"
|
[ -n "${ENV}" ] || ENV="${rwx_main_path}"
|
||||||
export ENV
|
export ENV
|
||||||
# prompt
|
# prompt
|
||||||
PS1="\$(rwx_shell_prompt \${?})"
|
PS1="\$(rwx_shell_prompt \${?})"
|
||||||
|
|
|
@ -29,3 +29,18 @@ esac
|
||||||
.....() {
|
.....() {
|
||||||
cd ../../../..
|
cd ../../../..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC3033
|
||||||
|
......() {
|
||||||
|
cd ../../../../..
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC3033
|
||||||
|
.......() {
|
||||||
|
cd ../../../../../..
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC3033
|
||||||
|
........() {
|
||||||
|
cd ../../../../../../..
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue