From 466a488826c6490b496220a9c62b57645eac3da7 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Wed, 16 Apr 2025 15:25:12 -0400 Subject: [PATCH] AutoYADM commit: 2025-04-16 15:25:12 --- .config/fish/functions/update.fish | 43 +++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/.config/fish/functions/update.fish b/.config/fish/functions/update.fish index 9673e7fb..4212ca84 100644 --- a/.config/fish/functions/update.fish +++ b/.config/fish/functions/update.fish @@ -1,6 +1,41 @@ function update --description "Update everything" - cargo install-update -a - gup update - uv tool upgrade --all - paru -Syu + set -l termcmd foot fish -c + set -l lines 'cargo install-update -a +gup update +uv tool upgrade --all +paru -Syu +flatpak update' + set -l cmds (string split \n -- $lines | string trim) + echo Commands to be run: + for i in $cmds + echo $i + end + if isatty stdin; and isatty stdout + while read --nchars 1 -l response --prompt-str="Run on multiple terminals? (y/n)" or return 1 + switch $response + case y Y + for cmd in $cmds + # max 2 jobs at a time + while test (count (jobs -p)) -ge 2 + sleep 0.5 + end + $termcmd $cmd &>/dev/null & + end + wait + break + case n N + for cmd in $cmds + eval $cmd + end + break + case '*' + echo Invalid input! + continue + end + end + else + for cmd in $cmds + eval $cmd + end + end end