This commit is contained in:
pika 2025-05-22 12:01:12 +02:00
parent d3d137a22b
commit db7ac16675
3 changed files with 83 additions and 24 deletions

View file

@ -1,3 +1,11 @@
# Define color variables
RED='\033[0;31m'
YELLOW='\033[0;33m'
CYAN='\033[0;36m'
GREEN='\033[1;32m'
NC='\033[0m' # No Color
BOLD='\033[1m'
# INFO: # INFO:
# ╭──────────╮ # ╭──────────╮
# │ defaults │ # │ defaults │
@ -587,6 +595,37 @@ missing() {
done done
} }
# INFO:
# ╭─────────────────╮
# │ other functions │
# ╰─────────────────╯
source-script() {
local url="$1"
local import="$(mktemp)"
# ─< if $1 is a local file, source this one instead >─────────────────────────────────────
if [ -f "$url" ]; then
source "$url"
sleep 0.1
return 0
else
echo_info "Sourcing external script:${NC} $url"
# ─< if $1 is a url, grab it and source it, also deletes afterwards >─────────────────────
if command_exists curl; then
curl -fsSL $url -o $import
elif command_exists wget; then
wget -o $import $url
else
echo "curl/wget is required, but missing.."
exit 69
fi
source "$import"
sleep 0.1
rm -f "$import"
fi
}
main() { main() {
# ─< g stands for GIT >───────────────────────────────────────────────────────────────────── # ─< g stands for GIT >─────────────────────────────────────────────────────────────────────
if command_exists git; then if command_exists git; then

View file

@ -41,7 +41,8 @@ _check() {
} }
_install() { _install() {
case "$1" in for arg in "$@"; do
case "arg" in
--help | -h) --help | -h)
_help _help
;; ;;
@ -56,6 +57,7 @@ _install() {
fi fi
;; ;;
esac esac
done
} }
# _setup(){ # _setup(){

36
.zshrc
View file

@ -38,19 +38,19 @@ BOLD='\033[1m'
# Functions to store messages # Functions to store messages
echo_error() { echo_error() {
_MESSAGES[error]+="${RED}$1${NC}\n" _MESSAGES[error]+="${RED}$@${NC}\n"
} }
echo_missing() { echo_missing() {
_MESSAGES[missing]+="${YELLOW} 󱥸 $1${NC}\n" _MESSAGES[missing]+="${YELLOW} 󱥸 $@${NC}\n"
} }
echo_warning() { echo_warning() {
_MESSAGES[warn]+="${YELLOW}⚠️ $1${NC}\n" _MESSAGES[warn]+="${YELLOW}⚠️ $@${NC}\n"
} }
echo_info() { echo_info() {
_MESSAGES[info]+="${CYAN} $1${NC}\n" _MESSAGES[info]+="${CYAN} $@${NC}\n"
} }
# Display stored messages # Display stored messages
@ -113,36 +113,54 @@ __get_Packager__() {
case "$DISTRO" in case "$DISTRO" in
*debian*) *debian*)
pkg_install() {
if command_exists nala; then
$_sudo nala install --assume-yes "$@"
else
$_sudo apt install --assume-yes "$@"
fi
}
if command_exists nala; then if command_exists nala; then
alias search="nala search" alias search="nala search"
alias install="$_sudo nala install --assume-yes"
alias update="$_sudo nala update && $_sudo nala upgrade --full" alias update="$_sudo nala update && $_sudo nala upgrade --full"
alias remove="$_sudo nala purge" alias remove="$_sudo nala purge"
else else
alias search="apt-cache search" alias search="apt-cache search"
alias install="$_sudo apt install --yes"
alias update="$_sudo apt update && $_sudo apt upgrade" alias update="$_sudo apt update && $_sudo apt upgrade"
alias remove="$_sudo apt purge" alias remove="$_sudo apt purge"
fi fi
alias unbreak="$_sudo dpkg --configure -a" alias unbreak="$_sudo dpkg --configure -a"
alias install="pkg_install"
;; ;;
*arch*) *arch*)
pkg_install() {
if command_exists paru; then
paru -S --color always --noconfirm --needed "$@"
elif command_exists yay; then
yay -S --color always --noconfirm --needed "$@"
else
$_sudo pacman -S --color always --noconfirm --needed "$@"
fi
}
if command_exists paru; then if command_exists paru; then
alias search="paru -Ss --color always" alias search="paru -Ss --color always"
alias install="paru -S --color always --noconfirm" # alias install="paru -S --color always --noconfirm"
alias update="paru -Syu --color always" alias update="paru -Syu --color always"
alias remove="paru -R --color always" alias remove="paru -R --color always"
elif command_exists yay; then elif command_exists yay; then
alias search="yay -Ss --color always" alias search="yay -Ss --color always"
alias install="yay -S --noconfirm --color always" # alias install="yay -S --noconfirm --color always"
alias update="yay -Syu --color always" alias update="yay -Syu --color always"
alias remove="yay -R --color always" alias remove="yay -R --color always"
else else
alias search="$_sudo pacman -Ss --color always" alias search="$_sudo pacman -Ss --color always"
alias install="$_sudo pacman -S --noconfirm --color always" # alias install="$_sudo pacman -S --noconfirm --color always"
alias update="$_sudo pacman -Syu --color always" alias update="$_sudo pacman -Syu --color always"
alias remove="$_sudo pacman -R --color always" alias remove="$_sudo pacman -R --color always"
fi fi
alias install="pkg_install"
;; ;;
*rhel* | *fedora*) *rhel* | *fedora*)
alias search="dnf search" alias search="dnf search"