This commit is contained in:
pika 2025-05-24 00:20:34 +02:00
parent be5fdade23
commit 606172a7e7

View file

@ -128,19 +128,23 @@ check-and-install() {
if [[ -z $2 ]]; then if [[ -z $2 ]]; then
spin bold yellow "Installing $pkg" spin bold yellow "Installing $pkg"
if ! command-exists "$pkg"; then if ! command-exists "$pkg"; then
if run pkg-install "$pkg"; then if run --err err pkg-install "$pkg"; then
upclear
check bold "$(pen green bold 'Installed') $pkg" check bold "$(pen green bold 'Installed') $pkg"
else else
throw bold red "Error installing $pkg" upclear
throw "Something went wrong! Could not install $(pen bold red $pkg)"
echo-error "${err:-}"
fi fi
else else
upclear
check bold "$pkg $(pen grey bold 'was already installed')" check bold "$pkg $(pen grey bold 'was already installed')"
# echo_pkg deps "skipping $pkg - as it's ${RED}already installed.." # echo_pkg deps "skipping $pkg - as it's ${RED}already installed.."
fi fi
else else
local pkgs="${#@}" local pkglength="${#@}"
# ─< else go though the list of items and do the same >─────────────────────────────────── # ─< else go though the list of items and do the same >───────────────────────────────────
pen grey "Packages to install: $(pen green bold $pkgs)" pen grey "Packages to install: $(pen green bold $pkglength)"
for pkg in "$@"; do for pkg in "$@"; do
if ! command-exists $pkg; then if ! command-exists $pkg; then
spin bold "$(pen bold yellow Installing) $pkg" spin bold "$(pen bold yellow Installing) $pkg"
@ -153,7 +157,8 @@ check-and-install() {
echo-error "${err:-}" echo-error "${err:-}"
fi fi
else else
check "$pkg $(pen grey already installed)" upclear
check bold "$pkg $(pen grey bold 'was already installed')"
fi fi
done done
fi fi