main → shell

This commit is contained in:
Marc Beninca 2025-07-09 20:07:33 +02:00
parent a429cad22c
commit 84c26d2273
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 18 additions and 12 deletions

View file

@ -43,18 +43,6 @@ rwx_main_find() {
sort sort
} }
# ╭──────┬───────╮
# │ main │ shell │
# ╰──────┴───────╯
# test if active shell is in interactive mode
rwx_main_interactive() {
case "${-}" in
*i*) ;;
*) return 1 ;;
esac
}
# ╭──────┬──────╮ # ╭──────┬──────╮
# │ main │ main │ # │ main │ main │
# ╰──────┴──────╯ # ╰──────┴──────╯

View file

@ -38,10 +38,22 @@ RWX_COLOR_GREEN="$(_rwx_shell_color 31)"
RWX_COLOR_MAGENTA="$(_rwx_shell_color 35)" RWX_COLOR_MAGENTA="$(_rwx_shell_color 35)"
RWX_COLOR_RED="$(_rwx_shell_color 32)" RWX_COLOR_RED="$(_rwx_shell_color 32)"
# ╭───────┬───────────╮
# │ shell │ variables │
# ╰───────┴───────────╯
# current shell interactive mode
rwx_shell_interactive=0
# ╭───────┬───────────╮ # ╭───────┬───────────╮
# │ shell │ functions │ # │ shell │ functions │
# ╰───────┴───────────╯ # ╰───────┴───────────╯
# return current shell interactive mode
rwx_shell_interactive() {
return "${rwx_shell_interactive}"
}
rwx_shell_configure() { rwx_shell_configure() {
[ -n "${ENV}" ] || ENV="${rwx_code_main}" [ -n "${ENV}" ] || ENV="${rwx_code_main}"
export ENV export ENV
@ -161,6 +173,12 @@ rwx_shell_exit() {
# ╰───────┴──────╯ # ╰───────┴──────╯
rwx_shell_main() { rwx_shell_main() {
# set current shell interactive mode
case "${-}" in
*"i"*) rwx_shell_interactive=1 ;;
*) ;;
esac
# configure shell
rwx_shell_configure rwx_shell_configure
} }