diff --git a/neovim.sh b/neovim.sh index c15a571..1076e92 100644 --- a/neovim.sh +++ b/neovim.sh @@ -37,8 +37,8 @@ } # command for executing silent mode only when nessessairy - # ex: sjhakjhskb "Building $PACKAGE" _install neovim - sjhakjhskb() { + # ex: runer "Building $PACKAGE" _install neovim + runer() { local msg=$1 local cmd="${@:1}" local err out @@ -58,6 +58,7 @@ } getDependencies() { + local err echo_pkg deps "Checking build dependencies, and installs missing.." local depsDebian=(git ninja-build gettext cmake curl build-essential) @@ -79,7 +80,20 @@ case "$distro" in debian | ubuntu | arch | fedora | alpine | opensuse) - checkAndInstall "${pkgArray[@]}" + for pkg in "${pkgArray[@]}"; do + if ! command_exists $pkg; then + spin red "Installing $pkg" + sleep 1 + if run --err err _install $pkg; then + check "Installed $pkg" + else + throw "Something went wrong! Could not install $(pen bold red $pkg)" + throw "${err:-}" + fi + else + pen green "$pkg already installed." + fi + done ;; *) echo_error "Cannot install for $distro" @@ -101,7 +115,7 @@ if command_exists git; then sleep 1 - if sjhakjhskb git clone --depth=1 https://github.com/neovim/neovim.git; then + if runer git clone --depth=1 https://github.com/neovim/neovim.git; then check green "Cloned $PACKAGE sources" line @@ -122,7 +136,7 @@ line # echo_pkg build "Compiling neovim from source" spin "Compiling neovim from source" - if sjhakjhskb make CMAKE_BUILD_TYPE=RelWithDebInfo; then + if runer make CMAKE_BUILD_TYPE=RelWithDebInfo; then check "Compiled $PACKAGE from source" line echo_pkg install @@ -138,7 +152,7 @@ if [ -d "$HOME/.config/nvim/" ]; then # echo_pkg qol "Prefetching neovim setup configuration.." spin "Prefetching neovim setup configuration.." - if sjhakjhskb nvim --headless +q; then + if runer nvim --headless +q; then check "Prefetched config" else throw "Prefetching config went terribly wrong!" @@ -156,8 +170,8 @@ local err out local url="https://git.k4li.de/dotfiles/nvim.git" spin yellow "Cloning pika's standard config" - # if sjhakjhskb install-stuff; then - if sjhakjhskb git clone --recursive --depth=1 $url "$HOME/.config/nvim"; then + # if runer install-stuff; then + if runer git clone --recursive --depth=1 $url "$HOME/.config/nvim"; then check "Cloned neovim config" line pen "${out:-}" @@ -167,7 +181,7 @@ fi spin bold yellow "Also sourcing config!" - if sjhakjhskb nvim --headless +q; then + if runer nvim --headless +q; then check "Prefetching config was successfull" line pen "${out:-}" @@ -180,8 +194,8 @@ "pika's minimal config") local url="https://git.k4li.de/dotfiles/nvim-mini.git" spin yellow "Cloning pika's standard config" - # if sjhakjhskb install-stuff; then - if sjhakjhskb git clone --recursive --depth=1 $url "$HOME/.config/nvim"; then + # if runer install-stuff; then + if runer git clone --recursive --depth=1 $url "$HOME/.config/nvim"; then check "Cloned neovim config" line pen "${out:-}" @@ -191,7 +205,7 @@ fi spin bold yellow "Also sourcing config!" - if sjhakjhskb nvim --headless +q; then + if runer nvim --headless +q; then check "Prefetching config was successfull" line pen "${out:-}" @@ -250,9 +264,9 @@ done # if $silent; then - # sjhakjhskb="run --err err" + # runer="run --err err" # else - # sjhakjhskb="" + # runer="" # fi main