AutoYADM commit: 2025-04-29 14:15:05

This commit is contained in:
Daniel Fichtinger 2025-04-29 14:15:05 -04:00
parent 90fef97ba4
commit 07ec1a0782

View file

@ -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