diff --git a/.bashrc b/.bashrc index 6c3b5db..39e4b6c 100644 --- a/.bashrc +++ b/.bashrc @@ -4,23 +4,45 @@ function echo_error() { echo -e "\033[0;1;31merror:\033[0;31m\t${*}\033[0m"; } function echo_binfo() { echo -e "\033[0;1;34mInfo:\033[0;34m\t${*}\033[0m"; } function echo_info() { echo -e "\033[0;35m${*}\033[0m"; } +# ─< check if command exists >──────────────────────────────────────────────────────────── +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + if command_exists curl; then alias install_pkg='bash -c "$(curl -sSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/snippets/install_pkg.sh)" -- ' else echo_error "curl is not installed, universal install disabled!" fi +# ─< Silent execution >───────────────────────────────────────────────────────────────── +silentexec() { + "$@" >/dev/null 2>&1 +} + +check_root() { + if [[ "${EUID}" -ne 0 ]]; then + if command_exists sudo; then + _sudo="sudo" + else + _sudo="" + echo_info "-- sudo was not found on this system ! --" + fi + else + _sudo="" + fi +} + i_blesh() { install_pkg gawk make && - git clone https://github.com/akinomyoga/ble.sh.git /tmp/blesh && - $(cd /tmp/blesh && make && make INSDIR="$HOME/.local/share/blesh" install) + git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git /tmp/blesh && + $(cd /tmp/ && make -C ble.sh install PREFIX=~/.local) } # ─< ble.sh -- https://github.com/akinomyoga/ble.sh >───────────────────────────────────── if [[ ! -f $HOME/.local/share/blesh/ble.sh ]]; then i_blesh else - [[ $- == *i* ]] && - source "$HOME/.local/share/blesh/ble.sh" --attach=none + source "$HOME/.local/share/blesh/ble.sh" --attach=none fi _sensible.bash_() { @@ -221,29 +243,6 @@ _color_prompt_() { fi } -# ─< check if command exists >──────────────────────────────────────────────────────────── -command_exists() { - command -v "$1" >/dev/null 2>&1 -} - -# ─< Silent execution >───────────────────────────────────────────────────────────────── -silentexec() { - "$@" >/dev/null 2>&1 -} - -check_root() { - if [[ "${EUID}" -ne 0 ]]; then - if command_exists sudo; then - _sudo="sudo" - else - _sudo="" - echo_info "-- sudo was not found on this system ! --" - fi - else - _sudo="" - fi -} - _zoxide_() { if command_exists zoxide; then eval "$(zoxide init bash)" @@ -341,7 +340,6 @@ _cli_qol_() { else curl -s https://ohmyposh.dev/install.sh | sudo bash -s -- -d /usr/bin/ fi - } _games() {