cache/wip
This commit is contained in:
parent
ebc41e8a53
commit
8c55351aae
1 changed files with 27 additions and 2 deletions
29
sh/main.sh
29
sh/main.sh
|
@ -37,6 +37,8 @@ RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}"
|
|||
|
||||
# run initial steps
|
||||
rwx_main() {
|
||||
# cache main
|
||||
rwx_cache "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"
|
||||
# source system root
|
||||
if ! rwx_source "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"; then
|
||||
__rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}"
|
||||
|
@ -53,6 +55,28 @@ rwx_main() {
|
|||
fi
|
||||
}
|
||||
|
||||
# ╭──────┬───────╮
|
||||
# │ main │ cache │
|
||||
# ╰──────┴───────╯
|
||||
|
||||
rwx_cache() {
|
||||
local root="${1}"
|
||||
local module="${2}"
|
||||
local name="${module%.sh}"
|
||||
local path="${root}/${module}"
|
||||
local text="$(cat "${path}")"
|
||||
case "${text}" in
|
||||
"#!"*) RWX_CODE="${text}" ;;
|
||||
*) RWX_CODE="${RWX_CODE}
|
||||
|
||||
# ╭╮
|
||||
# │ ${name} │
|
||||
# ╰╯
|
||||
|
||||
${text}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ╭──────┬────────╮
|
||||
# │ main │ source │
|
||||
# ╰──────┴────────╯
|
||||
|
@ -71,9 +95,10 @@ rwx_source() {
|
|||
for module in $(rwx_find_shell "${root}" "${file}"); do
|
||||
count=$((count + 1))
|
||||
__rwx_log "$(printf "%02d" "${count}") ${module%.sh}"
|
||||
module="${root}/${module}"
|
||||
# shellcheck disable=SC1090
|
||||
. "${module}"
|
||||
. "${root}/${module}"
|
||||
# cache code
|
||||
rwx_cache "${root}" "${module}"
|
||||
done
|
||||
rwx_ifs_unset
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue