From 85773caf45baf5ce065ed22c569d71d80a4cde85 Mon Sep 17 00:00:00 2001 From: pika Date: Thu, 27 Feb 2025 14:10:52 +0100 Subject: [PATCH] changed the packager function a bit --- .zsh/.aliases.zsh | 62 ++++++++++++++++++++++------------------------ .zsh/.installs.zsh | 5 ++++ 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/.zsh/.aliases.zsh b/.zsh/.aliases.zsh index f38f83d..7296f60 100644 --- a/.zsh/.aliases.zsh +++ b/.zsh/.aliases.zsh @@ -1,8 +1,15 @@ __autopackager__() { - . /etc/os-release - case "$ID" in - # Debian-based - ubuntu | debian | pop | kali | zorin | rhinoh | raspbian) + # # Ensure _sudo is set + # [ -z "${_sudo+x}" ] && _sudo="sudo" + + # Define command_exists if not already defined + # command_exists() { command -v "$1" >/dev/null 2>&1; } + + # Load OS release information + [ -f /etc/os-release ] && . /etc/os-release || return 1 + + case "$ID_LIKE" in + *debian*) if command_exists nala; then alias search="nala search" alias install="$_sudo nala install --assume-yes" @@ -17,8 +24,7 @@ __autopackager__() { alias unbreak="$_sudo dpkg --configure -a" ;; - # Arch-based - arch | manjaro | endeavouros | garuda) + *arch*) if command_exists paru; then alias search="paru -Ss" alias install="paru -S --noconfirm" @@ -37,28 +43,30 @@ __autopackager__() { fi ;; - # RHEL-based - fedora | centos) + *rhel* | *fedora*) alias search="dnf search" - alias install="$_sudo dnf install" - alias update="$_sudo dnf update" - alias remove="$_sudo dnf remove" + alias install="$_sudo dnf install -y --skip-missing" + alias update="$_sudo dnf update -y" + alias remove="$_sudo dnf remove -y" ;; - # openSUSE - opensuse-*) + *suse*) alias search="zypper search" alias install="$_sudo zypper install --no-confirm" alias update="$_sudo zypper update" alias remove="$_sudo zypper remove" ;; - # Alpine - alpine) + *alpine*) 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 } @@ -149,25 +157,13 @@ _alias() { ta() { command tmux list-sessions >/dev/null 2>&1 if [ $? -eq 0 ]; then - if command_exists notify-send; then - notify-send "TMUX" "${tmux_y}" - sleep 0.5 - tmux attach - else - echo_info "${tmux_y}" - sleep 0.5 - tmux attach - fi + echo "${tmux_y}" + sleep 0.3 + tmux attach else - if command_exists notify-send; then - notify-send "TMUX" "${tmux_n}" - sleep 0.5 - tmux - else - echo_info "$tmux_n" - sleep 0.5 - tmux - fi + echo "${tmux_n}" + sleep 0.3 + tmux fi } alias ts="tmux source $HOME/.tmux.conf" diff --git a/.zsh/.installs.zsh b/.zsh/.installs.zsh index 9527705..dafac8c 100644 --- a/.zsh/.installs.zsh +++ b/.zsh/.installs.zsh @@ -31,6 +31,11 @@ _install() { --help | -h) _help ;; + nvim) + if _check; then + _install_func "neovim" + fi + ;; *) if _check; then _install_func "$1"