Compare commits
3 commits
bcf879ddc3
...
5225d6a1ae
Author | SHA1 | Date | |
---|---|---|---|
5225d6a1ae | |||
80949cf6c0 | |||
79a8584fde |
4 changed files with 36 additions and 36 deletions
|
@ -57,18 +57,6 @@ rwx_code_cache_user() {
|
|||
echo "${rwx_code_cache_user}"
|
||||
}
|
||||
|
||||
# ╭──────┬──────╮
|
||||
# │ code │ help │
|
||||
# ╰──────┴──────╯
|
||||
|
||||
# output help message
|
||||
rwx_code_help() {
|
||||
rwx_log "" \
|
||||
"rwx_… = functions" \
|
||||
" a__… = aliases" \
|
||||
" u__… = user"
|
||||
}
|
||||
|
||||
# ╭──────┬─────────╮
|
||||
# │ code │ install │
|
||||
# ╰──────┴─────────╯
|
||||
|
@ -296,26 +284,4 @@ ${rwx_code_modules_user}
|
|||
EOF
|
||||
# load code cache
|
||||
rwx_code_load
|
||||
# set command
|
||||
local command
|
||||
# command name used to run
|
||||
# (stripped from hyphen interactive flag)
|
||||
command="$(basename "${0}" | sed "s|^-||")"
|
||||
case "${command}" in
|
||||
"bash" | "dash" | "sh") unset command ;;
|
||||
*) ;;
|
||||
esac
|
||||
# context / shell
|
||||
if rwx_shell_interactive; then
|
||||
# display help
|
||||
rwx_code_help
|
||||
# context / command
|
||||
else
|
||||
local function
|
||||
# find the matching function
|
||||
function="$(rwx_code_command_function "${command}")"
|
||||
if [ -n "${function}" ]; then
|
||||
"${function}" "${@}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -35,6 +35,10 @@ _rwx_log() {
|
|||
done
|
||||
}
|
||||
|
||||
# ╭─────┬────────╮
|
||||
# │ log │ levels │
|
||||
# ╰─────┴────────╯
|
||||
|
||||
rwx_log_fatal() {
|
||||
local code="${1}"
|
||||
shift
|
||||
|
|
|
@ -53,6 +53,7 @@ rwx_main_find() {
|
|||
|
||||
# run required initial steps
|
||||
#< core/code
|
||||
#< core/shell
|
||||
rwx_main_main() {
|
||||
local module
|
||||
local modules
|
||||
|
@ -70,6 +71,8 @@ ${modules}
|
|||
EOF
|
||||
# run code module main function with found main modules
|
||||
rwx_code_main "${modules}" "${@}"
|
||||
# run shell module main function
|
||||
rwx_shell_main
|
||||
}
|
||||
|
||||
# run main function
|
||||
|
|
|
@ -49,6 +49,14 @@ rwx_shell_interactive=1
|
|||
# │ shell │ functions │
|
||||
# ╰───────┴───────────╯
|
||||
|
||||
# output help message
|
||||
rwx_shell_help() {
|
||||
rwx_log "" \
|
||||
"rwx_… = functions" \
|
||||
" a__… = aliases" \
|
||||
" u__… = user"
|
||||
}
|
||||
|
||||
# return current shell interactive mode
|
||||
rwx_shell_interactive() {
|
||||
return "${rwx_shell_interactive}"
|
||||
|
@ -180,6 +188,25 @@ rwx_shell_main() {
|
|||
esac
|
||||
# configure shell
|
||||
rwx_shell_configure
|
||||
# context / shell
|
||||
if rwx_shell_interactive; then
|
||||
# display help
|
||||
rwx_shell_help
|
||||
# context / command
|
||||
else
|
||||
local command
|
||||
local function
|
||||
# command name used to run
|
||||
# (stripped from hyphen interactive flag)
|
||||
command="$(basename "${0}" | sed "s|^-||")"
|
||||
case "${command}" in
|
||||
"bash" | "dash" | "sh") unset command ;;
|
||||
*) ;;
|
||||
esac
|
||||
# find the matching function
|
||||
function="$(rwx_code_command_function "${command}")"
|
||||
if [ -n "${function}" ]; then
|
||||
"${function}" "${@}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
rwx_shell_main
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue