diff options
| author | Thomas Schmucker <ts@its1.de> | 2026-07-09 10:44:13 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2026-07-09 10:44:13 +0200 |
| commit | 68ffbb8f23ed404096fedab8f404ab20f772f55f (patch) | |
| tree | e29f4a077301c0356ce3ab8456c1f5576c60e8c9 /bootstrap/neovim-dict.sh | |
| parent | 2f12e12cbc6d57345f52f9eeddb49a42414d797e (diff) | |
| download | dotfiles-68ffbb8f23ed404096fedab8f404ab20f772f55f.tar.gz dotfiles-68ffbb8f23ed404096fedab8f404ab20f772f55f.tar.bz2 dotfiles-68ffbb8f23ed404096fedab8f404ab20f772f55f.zip | |
bootstrap: Skripte vereinheitlicht und etwas bessere Fehlermeldungen
Diffstat (limited to 'bootstrap/neovim-dict.sh')
| -rwxr-xr-x | bootstrap/neovim-dict.sh | 31 |
1 files changed, 21 insertions, 10 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" | |||
| 6 | 6 | ||
| 7 | cd "$SPELL_DIR" | 7 | cd "$SPELL_DIR" |
| 8 | 8 | ||
| 9 | die() { | ||
| 10 | printf 'Fehler: %s\n' "$*" >&2 | ||
| 11 | exit 1 | ||
| 12 | } | ||
| 13 | |||
| 14 | have() { | ||
| 15 | command -v "$1" >/dev/null 2>&1 | ||
| 16 | } | ||
| 17 | |||
| 9 | download() { | 18 | download() { |
| 10 | url="$1" | 19 | url="$1" |
| 11 | file=$(basename "$url") | 20 | file=$(basename "$url") |
| 12 | 21 | ||
| 13 | if [ -f "$file" ]; then | 22 | if [ -f "$file" ]; then |
| 14 | echo "Skipping $file (already exists)" | 23 | printf "✓ %-32s vorhanden\n" "$file" |
| 15 | return | 24 | return |
| 16 | fi | 25 | fi |
| 17 | 26 | ||
| 18 | echo "Downloading $file..." | 27 | printf "→ Lade %s herunter\n" "$file" |
| 19 | if command -v wget >/dev/null 2>&1; then | 28 | if have wget; then |
| 20 | wget -q --show-progress "$url" | 29 | wget -q --show-progress "$url" |
| 21 | elif command -v curl >/dev/null 2>&1; then | 30 | elif have curl; then |
| 22 | curl -fLO "$url" | 31 | curl -fLO "$url" |
| 23 | else | 32 | else |
| 24 | echo "ERROR: neither wget nor curl found" | 33 | die "weder wget noch curl gefunden" |
| 25 | exit 1 | ||
| 26 | fi | 34 | fi |
| 27 | } | 35 | } |
| 28 | 36 | ||
| 29 | # Deutsche Wörterbücher | 37 | main() { |
| 30 | download "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.spl" | 38 | download "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.spl" |
| 31 | download "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.sug" | 39 | download "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.sug" |
| 40 | |||
| 41 | printf "\nWörterbücher für Neovim installiert!\n" | ||
| 42 | } | ||
| 32 | 43 | ||
| 33 | echo "Deutsche Wörterbücher für Neovim installiert!" | 44 | main "$@" |
