From 4cab6852da8743afed58c2036edde918ac021405 Mon Sep 17 00:00:00 2001 From: pika Date: Thu, 22 May 2025 16:03:40 +0200 Subject: [PATCH] testing --- test.sh | 68 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/test.sh b/test.sh index 506323e..fc9c204 100755 --- a/test.sh +++ b/test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +deplist=() # ─< Check if the given command exists silently >───────────────────────────────────────── command_exists() { @@ -39,7 +40,6 @@ spin-get-dependencies() { depsAlpine=(bash zsh curl git neofetch waybar wlogout) # declare -A deplist - deplist=() declare -A deps=( [debian]="depsDebian" @@ -64,8 +64,7 @@ spin-get-dependencies() { fi done - check "pkglist: ${pkglist[*]}" - + check "pkglist: ${deplist[*]}" line # pen red "$deplist" @@ -75,7 +74,7 @@ spin-get-dependencies() { # pen bold grey "Dep: $dep" # done - spin-installation "${deplist[@]}" + # spin-installation "${deplist[@]}" # for pk in "${pkglist[@]}"; do # pen bold red "Pkg: $pk" @@ -92,23 +91,23 @@ spin-get-dependencies() { esac } -spin-installation() { - local err out - local pkgs="$@" - - for pkg in "${pkgs[@]}"; do - spin bold yellow "Installing $pkg" - if run --err err --out out pkg-install "$pkg"; then - check "Installed $pkg" - line - else - throw "$pkg could not get installed.." - echo_error "${err:-}" - echo_note "${out:-}" - line - fi - done -} +# spin-installation() { +# local err out +# local pkgs="$@" +# +# for pkg in "${pkgs[@]}"; do +# spin bold yellow "Installing $pkg" +# if run --err err --out out pkg-install "$pkg"; then +# check "Installed $pkg" +# line +# else +# throw "$pkg could not get installed.." +# echo_error "${err:-}" +# echo_note "${out:-}" +# line +# fi +# done +# } main() { local err out @@ -119,19 +118,22 @@ main() { check "Dependency list generated!" pen red bold "There are ${#deplist[@]} items to install.." # local pkgs="$@" - - for pkg in "${deplist[@]}"; do - spin bold yellow "Installing $pkg" - if run --err err --out out pkg-install "$pkg"; then - check "Installed $pkg" - line - else - check "$pkg could not get installed.." - echo_error "${err:-}" - echo_note "${out:-}" - line - fi + for ((i = 0; i < "${#deplist[@]}"; i++)); do + for pkg in "${deplist[@]}"; do + spin bold yellow "Installing $pkg" + if run --err err --out out pkg-install "$pkg"; then + check "Installed $pkg" + line + else + check "$pkg could not get installed.." + echo_error "${err:-}" + echo_note "${out:-}" + line + continue + fi + done done + fi # case "$distro" in