This commit is contained in:
parent
2480e490be
commit
dd90da8a82
3 changed files with 54 additions and 32 deletions
|
@ -1,29 +0,0 @@
|
||||||
# shorten alias
|
|
||||||
a() {
|
|
||||||
alias \
|
|
||||||
"${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# swap directory (current ↔ previous)
|
|
||||||
sd() {
|
|
||||||
cd \
|
|
||||||
- ||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# exit terminal
|
|
||||||
x() {
|
|
||||||
exit \
|
|
||||||
"${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
[ "${RWX_SHELL}" = "bash" ] || return
|
|
||||||
|
|
||||||
# shellcheck disable=SC3033
|
|
||||||
..() {
|
|
||||||
cd ..
|
|
||||||
}
|
|
||||||
# shellcheck disable=SC3033
|
|
||||||
...() {
|
|
||||||
cd ../..
|
|
||||||
}
|
|
|
@ -26,9 +26,6 @@ RWX_SELF_NAME="rwx"
|
||||||
# │ main │ variables │
|
# │ main │ variables │
|
||||||
# ╰──────┴───────────╯
|
# ╰──────┴───────────╯
|
||||||
|
|
||||||
# currently running shell name
|
|
||||||
RWX_SHELL="$(cat "/proc/${$}/comm")"
|
|
||||||
|
|
||||||
# system root directory of the project
|
# system root directory of the project
|
||||||
RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}"
|
RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}"
|
||||||
# user root directory of the project
|
# user root directory of the project
|
||||||
|
|
54
sh/shell.sh
54
sh/shell.sh
|
@ -1,3 +1,7 @@
|
||||||
|
# ╭───────╮
|
||||||
|
# │ shell │
|
||||||
|
# ╰───────╯
|
||||||
|
|
||||||
_rwx_shell_color() {
|
_rwx_shell_color() {
|
||||||
local code="${1}"
|
local code="${1}"
|
||||||
case "${RWX_SHELL}" in
|
case "${RWX_SHELL}" in
|
||||||
|
@ -19,6 +23,11 @@ _rwx_shell_color() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ╭───────┬───────────╮
|
||||||
|
# │ shell │ constants │
|
||||||
|
# ╰───────┴───────────╯
|
||||||
|
|
||||||
RWX_COLOR_BROWN="$(_rwx_shell_color 33)"
|
RWX_COLOR_BROWN="$(_rwx_shell_color 33)"
|
||||||
RWX_COLOR_CYAN="$(_rwx_shell_color 36)"
|
RWX_COLOR_CYAN="$(_rwx_shell_color 36)"
|
||||||
RWX_COLOR_DEFAULT="$(_rwx_shell_color)"
|
RWX_COLOR_DEFAULT="$(_rwx_shell_color)"
|
||||||
|
@ -26,6 +35,17 @@ 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 │
|
||||||
|
# ╰───────┴───────────╯
|
||||||
|
|
||||||
|
# currently running shell name
|
||||||
|
RWX_SHELL="$(cat "/proc/${$}/comm")"
|
||||||
|
|
||||||
|
# ╭───────┬───────────╮
|
||||||
|
# │ shell │ functions │
|
||||||
|
# ╰───────┴───────────╯
|
||||||
|
|
||||||
rwx_shell_configure() {
|
rwx_shell_configure() {
|
||||||
[ -n "${ENV}" ] || ENV="${RWX_MAIN_PATH}"
|
[ -n "${ENV}" ] || ENV="${RWX_MAIN_PATH}"
|
||||||
export ENV
|
export ENV
|
||||||
|
@ -114,3 +134,37 @@ rwx_shell_prompt() {
|
||||||
# print
|
# print
|
||||||
printf "%b" "${view}"
|
printf "%b" "${view}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ╭───────┬───────────╮
|
||||||
|
# │ shell │ shortcuts │
|
||||||
|
# ╰───────┴───────────╯
|
||||||
|
|
||||||
|
# shorten alias
|
||||||
|
a() {
|
||||||
|
alias \
|
||||||
|
"${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# swap directory (current ↔ previous)
|
||||||
|
sd() {
|
||||||
|
cd \
|
||||||
|
- ||
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# exit terminal
|
||||||
|
x() {
|
||||||
|
exit \
|
||||||
|
"${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "${RWX_SHELL}" = "bash" ] || return
|
||||||
|
|
||||||
|
# shellcheck disable=SC3033
|
||||||
|
..() {
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
# shellcheck disable=SC3033
|
||||||
|
...() {
|
||||||
|
cd ../..
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue