From 07ec1a0782db2357ac949f74b4c1b27b1377fc9e Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 29 Apr 2025 14:15:05 -0400 Subject: [PATCH] AutoYADM commit: 2025-04-29 14:15:05 --- .config/fish/functions/update.fish | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.config/fish/functions/update.fish b/.config/fish/functions/update.fish index f1b82d81..317cd407 100644 --- a/.config/fish/functions/update.fish +++ b/.config/fish/functions/update.fish @@ -1,28 +1,29 @@ function update --description "Update everything" # autoconfirm - argparse y/no-confirm -- $argv + # or force no multiterm + argparse y/no-confirm o/one-term -- $argv # TODO: add configuration options and publish? - set -l termcmd foot fish -c + set -g termcmd foot fish -c set -l std 'cargo install-update -a gup update -uv tool upgrade --all ' +uv tool upgrade --all' set -l noconfirm 'flatpak update -y yes | paru -Syu' set -l confirm 'flatpak update paru -Syu' - set -l cmds (string split \n -- $std | string trim) + set -g cmds (string split \n -- $std | string trim) if set -q _flag_y - set --append cmds $noconfirm + set --append cmds (string split \n -- $noconfirm | string trim) sudo -v else - set --append cmds $confirm + set --append cmds (string split \n -- $confirm | string trim) end echo Commands to be run: for i in $cmds echo $i end - return 0 - function execute -a cmds + + function execute argparse i/interactive -- $argv if set -ql _flag_i for cmd in $cmds @@ -43,15 +44,15 @@ paru -Syu' end end - if isatty stdin; and isatty stdout + if not set -ql _flag_o && isatty stdin && isatty stdout while read --nchars 1 -l response --prompt-str="Run on multiple terminals? (y/n)" or return 1 switch $response case y Y - execute --interactive $cmds + execute --interactive wait break case n N - execute $cmds + execute break case '*' echo Invalid input! @@ -59,6 +60,6 @@ paru -Syu' end end else - execute $cmds + execute end end