From 68ffbb8f23ed404096fedab8f404ab20f772f55f Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Thu, 9 Jul 2026 10:44:13 +0200 Subject: bootstrap: Skripte vereinheitlicht und etwas bessere Fehlermeldungen --- bootstrap/neovim-dict.sh | 31 +++++++++++++++++++++---------- bootstrap/neovim.sh | 2 +- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/bootstrap/neovim-dict.sh b/bootstrap/neovim-dict.sh index fa29728..77a7db8 100755 --- a/bootstrap/neovim-dict.sh +++ b/bootstrap/neovim-dict.sh @@ -6,28 +6,39 @@ mkdir -p "$SPELL_DIR" cd "$SPELL_DIR" +die() { + printf 'Fehler: %s\n' "$*" >&2 + exit 1 +} + +have() { + command -v "$1" >/dev/null 2>&1 +} + download() { url="$1" file=$(basename "$url") if [ -f "$file" ]; then - echo "Skipping $file (already exists)" + printf "✓ %-32s vorhanden\n" "$file" return fi - echo "Downloading $file..." - if command -v wget >/dev/null 2>&1; then + printf "→ Lade %s herunter\n" "$file" + if have wget; then wget -q --show-progress "$url" - elif command -v curl >/dev/null 2>&1; then + elif have curl; then curl -fLO "$url" else - echo "ERROR: neither wget nor curl found" - exit 1 + die "weder wget noch curl gefunden" fi } -# Deutsche Wörterbücher -download "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.spl" -download "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.sug" +main() { + download "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.spl" + download "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.sug" + + printf "\nWörterbücher für Neovim installiert!\n" +} -echo "Deutsche Wörterbücher für Neovim installiert!" +main "$@" diff --git a/bootstrap/neovim.sh b/bootstrap/neovim.sh index 56a5247..d601dbd 100755 --- a/bootstrap/neovim.sh +++ b/bootstrap/neovim.sh @@ -5,7 +5,7 @@ set -eu OS="$(uname -s)" die() { - printf '%s\n' "$*" >&2 + printf 'Fehler: %s\n' "$*" >&2 exit 1 } -- cgit v1.3