From b0e1966d43575ce82aeef03560c33df0831ac976 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Tue, 25 Aug 2026 08:09:21 +0200 Subject: zsh: feinere update-funktionen --- zsh/zshrc | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'zsh') diff --git a/zsh/zshrc b/zsh/zshrc index 6f31eaa..ab3730d 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -80,11 +80,40 @@ alias pwgen='pwgen -s 48 1' alias ls='ls -G' # Funktionen +npm-update() { + if (($+commands[npm])); then + npm update -g --loglevel=info + fi +} + nvim-update() { - nvim --headless \ - -c "lua require[[lazy]].sync({ wait = true })" \ - -c "UpdateParsers" \ - -c "qa" + if (($+commands[nvim])); then + nvim --headless \ + -c "lua require[[lazy]].sync({ wait = true })" \ + -c "UpdateParsers" \ + -c "qa" + fi +} + +pkg-update() { + case "$OSTYPE" in + darwin*) + brew update && brew upgrade + ;; + freebsd*) + doas pkg update && doas pkg upgrade + ;; + *) + print -u2 "pkg-update: kein Paketmanager fuer $OSTYPE hinterlegt" + return 1 + ;; + esac +} + +system-update() { + npm-update || return + nvim-update || return + pkg-update } # Command completion -- cgit v1.3