Compare commits
1 commit
aec3d1a0af
...
dd90da8a82
Author | SHA1 | Date | |
---|---|---|---|
dd90da8a82 |
4 changed files with 38 additions and 51 deletions
|
@ -1,18 +0,0 @@
|
||||||
# shorten alias
|
|
||||||
a() {
|
|
||||||
alias \
|
|
||||||
"${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# swap directory (current ↔ previous)
|
|
||||||
sd() {
|
|
||||||
cd \
|
|
||||||
- ||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# exit terminal
|
|
||||||
x() {
|
|
||||||
exit \
|
|
||||||
"${@}"
|
|
||||||
}
|
|
|
@ -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
|
||||||
|
|
|
@ -35,6 +35,13 @@ 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 │
|
# │ shell │ functions │
|
||||||
# ╰───────┴───────────╯
|
# ╰───────┴───────────╯
|
||||||
|
@ -73,6 +80,7 @@ rwx_shell_configure() {
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
rwx_shell_configure
|
||||||
|
|
||||||
rwx_shell_prompt() {
|
rwx_shell_prompt() {
|
||||||
local date host id
|
local date host id
|
||||||
|
@ -127,12 +135,36 @@ rwx_shell_prompt() {
|
||||||
printf "%b" "${view}"
|
printf "%b" "${view}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ╭───────┬──────╮
|
# ╭───────┬───────────╮
|
||||||
# │ shell │ main │
|
# │ shell │ shortcuts │
|
||||||
# ╰───────┴──────╯
|
# ╰───────┴───────────╯
|
||||||
|
|
||||||
rwx_shell_main() {
|
# shorten alias
|
||||||
rwx_shell_configure
|
a() {
|
||||||
|
alias \
|
||||||
|
"${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
rwx_shell_main
|
# swap directory (current ↔ previous)
|
||||||
|
sd() {
|
||||||
|
cd \
|
||||||
|
- ||
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# exit terminal
|
||||||
|
x() {
|
||||||
|
exit \
|
||||||
|
"${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "${RWX_SHELL}" = "bash" ] || return
|
||||||
|
|
||||||
|
# shellcheck disable=SC3033
|
||||||
|
..() {
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
# shellcheck disable=SC3033
|
||||||
|
...() {
|
||||||
|
cd ../..
|
||||||
|
}
|
|
@ -1,24 +0,0 @@
|
||||||
# ╭───────┬──────╮
|
|
||||||
# │ shell │ bash │
|
|
||||||
# ╰───────┴──────╯
|
|
||||||
|
|
||||||
if [ "${RWX_SHELL}" = "bash" ]; then
|
|
||||||
|
|
||||||
# shellcheck disable=SC3033
|
|
||||||
..() {
|
|
||||||
cd ..
|
|
||||||
}
|
|
||||||
# shellcheck disable=SC3033
|
|
||||||
...() {
|
|
||||||
cd ../..
|
|
||||||
}
|
|
||||||
# shellcheck disable=SC3033
|
|
||||||
....() {
|
|
||||||
cd ../../..
|
|
||||||
}
|
|
||||||
# shellcheck disable=SC3033
|
|
||||||
.....() {
|
|
||||||
cd ../../../..
|
|
||||||
}
|
|
||||||
|
|
||||||
fi
|
|
Loading…
Add table
Add a link
Reference in a new issue