This commit is contained in:
parent
80949cf6c0
commit
5225d6a1ae
2 changed files with 29 additions and 33 deletions
|
@ -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,4 +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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue