changed bash_aliases to the better

This commit is contained in:
pika 2025-03-08 21:05:13 +01:00
parent 1551aa9dc2
commit 118bc0d1ed

View file

@ -46,83 +46,64 @@ check_root() {
check_root check_root
getPackager() { getPackager() {
pkg="apt dnf pacman zypper apk" # Load OS release information
for pkgmgr in $pkg; do [ -f /etc/os-release ] && . /etc/os-release || return 1
if command_exists "$pkgmgr"; then
PACKAGER="$pkgmgr"
fi
done
case "$PACKAGER" in DISTRO="${ID}:${ID_LIKE}"
apt)
case "$DISTRO" in
*debian*)
if command_exists nala; then if command_exists nala; then
search="nala search" alias search="nala search"
install="nala install --assume-yes" alias install="$_sudo nala install --assume-yes"
refresh="nala update" alias update="$_sudo nala update && $_sudo nala upgrade --full"
upgrade="nala upgrade --full" alias remove="$_sudo nala purge"
remove="nala purge"
alias update="$_sudo $refresh && $_sudo $upgrade"
alias install="$_sudo $refresh && $_sudo $install"
alias remove="$_sudo $remove"
alias search="$search"
elif command_exists apt; then
search="apt-cache search"
install="apt-get install --yes"
refresh="apt-get update"
upgrade="apt-get upgrade"
remove="apt-get purge"
alias update="$_sudo $refresh && $_sudo $upgrade"
alias install="$_sudo $refresh && $_sudo $install"
alias remove="$_sudo $remove"
alias search="$search"
else else
echo_error "APT ERROR" alias search="apt-cache search"
alias install="$_sudo apt-get install --yes"
alias update="$_sudo apt-get update && $_sudo apt-get upgrade"
alias remove="$_sudo apt-get purge"
fi fi
alias unbreak="$_sudo dpkg --configure -a"
;; ;;
dnf) *arch*)
if command_exists dnf; then if command_exists paru; then
alias install="dnf install --yes" alias search="paru -Ss"
alias update="dnf update"
alias remove="dnf remove"
alias search="dnf search"
else
echo_error "DNF ERROR"
fi
;;
pacman)
if command_exists yay; then
alias install="yay -S --noconfirm"
alias update="yay -Syu"
alias remove="yay -R"
alias search="yay -Ss"
elif command_exists paru; then
alias install="paru -S --noconfirm" alias install="paru -S --noconfirm"
alias update="paru -Syu" alias update="paru -Syu"
alias remove="paru -R" alias remove="paru -R"
alias search="paru -Ss" elif command_exists yay; then
elif command_exists pacman; then alias search="yay -Ss"
alias install="yay -S --noconfirm"
alias update="yay -Syu"
alias remove="yay -R"
else
alias search="$_sudo pacman -Ss"
alias install="$_sudo pacman -S --noconfirm" alias install="$_sudo pacman -S --noconfirm"
alias update="$_sudo pacman -Syu" alias update="$_sudo pacman -Syu"
alias remove="$_sudo pacman -R" alias remove="$_sudo pacman -R"
alias search="$_sudo pacman -Ss"
else
echo_error "PACMAN ERROR"
fi fi
;; ;;
zypper) *rhel* | *fedora*)
alias install="$_sudo zypper install" alias search="dnf search"
alias update="$_sudo zypper dup" alias install="$_sudo dnf install -y --skip-missing"
alias remove="$_sudo zypper remove" alias update="$_sudo dnf update -y"
alias search="$_sudo zypper search" alias remove="$_sudo dnf remove -y"
;; ;;
apk) *suse*)
install="apk add" alias search="zypper search"
update="apk update" alias install="$_sudo zypper install --no-confirm"
upgrade="apk upgrade" alias update="$_sudo zypper update"
remove="apk del" alias remove="$_sudo zypper remove"
alias install="$_sudo $install" ;;
alias update="$_sudo $update && $_sudo $upgrade" *alpine*)
alias remove="$_sudo $remove" alias install="$_sudo apk add"
alias update="$_sudo apk update && $_sudo apk upgrade"
alias remove="$_sudo apk del"
;;
*)
echo "Unsupported distro: $ID"
return 1
;; ;;
esac esac
} }
@ -308,16 +289,16 @@ _alias_() {
# Function to determine which Neovim command to use # Function to determine which Neovim command to use
choose_nvim() { choose_nvim() {
if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then if [ -n "$TMUX" ]; then
# If inside an active tmux session, use nvim
echo "command nvim"
return
elif [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then
# If in a graphical environment, use Neovide # If in a graphical environment, use Neovide
if command_exists neovide; then if command_exists neovide; then
echo "neovide --fork" echo "neovide --fork"
return return
fi fi
elif [ -n "$TMUX" ]; then
# If inside an active tmux session, use nvim
echo "command nvim"
return
fi fi
# Default to nvim # Default to nvim
echo "command nvim" echo "command nvim"