From 69b53ba2870f9abe808a57c09152c20113c21525 Mon Sep 17 00:00:00 2001 From: pika Date: Mon, 19 Aug 2024 18:20:12 +0200 Subject: [PATCH] some improvements regarding ble.sh --- .bashrc | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/.bashrc b/.bashrc index 0f152a6..3834036 100644 --- a/.bashrc +++ b/.bashrc @@ -140,11 +140,35 @@ _defaults_() { if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi - # Use bash-completion, if available - [[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && . /usr/share/bash-completion/bash_completion } -plugins() { +p_blesh() { + i_blesh() { + install gawk make && + git clone https://github.com/akinomyoga/ble.sh.git /tmp/blesh && + cd /tmp/blesh && + make + make INSDIR="$HOME/.local/share/blesh" install + } + # ─< ble.sh -- https://github.com/akinomyoga/ble.sh >───────────────────────────────────── + if [[ ! -e $HOME/.local/share/blesh/ble.sh ]]; then + i_blesh + else + [[ $- == *i* ]] && + source "$HOME/.local/share/blesh/ble.sh" --attach=none + fi +} + +p_basher() { + if [[ ! -d $HOME/.basher/ ]]; then + git clone --depth=1 https://github.com/basherpm/basher.git ~/.basher + else + export PATH="$HOME/.basher/bin:$PATH" + eval "$(basher init - bash)" && silentexec $(cd $HOME/.basher/ && git pull) + fi +} + +p_has() { if ! command_exists has; then $(git clone https://github.com/kdabir/has.git /tmp/has && cd /tmp/has && sudo make install) else @@ -153,21 +177,14 @@ plugins() { has $pkgs } fi - # ─< ble.sh -- https://github.com/akinomyoga/ble.sh >───────────────────────────────────── - [[ -f $HOME/.local/share/blesh/ble.sh ]] && . $HOME/.local/share/blesh/ble.sh - [[ ${BLE_VERSION-} ]] && ble-attach +} +plugins() { # ─< qfc -- https://github.com/pindexis/qfc >───────────────────────────────────────────── # [[ -s "$HOME/.qfc/bin/qfc.sh" ]] && source "$HOME/.qfc/bin/qfc.sh" - _basher() { - if [[ ! -d $HOME/.basher/ ]]; then - git clone --depth=1 https://github.com/basherpm/basher.git ~/.basher - else - export PATH="$HOME/.basher/bin:$PATH" - eval "$(basher init - bash)" && silentexec $(cd $HOME/.basher/ && git pull) - fi - } - _basher + # p_basher + p_has + p_blesh } _color_prompt_() { @@ -588,3 +605,4 @@ main() { tools } main +[[ ${BLE_VERSION-} ]] && ble-attach