AutoYADM commit: 2025-04-29 14:15:05
This commit is contained in:
parent
90fef97ba4
commit
07ec1a0782
1 changed files with 13 additions and 12 deletions
|
@ -1,28 +1,29 @@
|
||||||
function update --description "Update everything"
|
function update --description "Update everything"
|
||||||
# autoconfirm
|
# autoconfirm
|
||||||
argparse y/no-confirm -- $argv
|
# or force no multiterm
|
||||||
|
argparse y/no-confirm o/one-term -- $argv
|
||||||
# TODO: add configuration options and publish?
|
# 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
|
set -l std 'cargo install-update -a
|
||||||
gup update
|
gup update
|
||||||
uv tool upgrade --all '
|
uv tool upgrade --all'
|
||||||
set -l noconfirm 'flatpak update -y
|
set -l noconfirm 'flatpak update -y
|
||||||
yes | paru -Syu'
|
yes | paru -Syu'
|
||||||
set -l confirm 'flatpak update
|
set -l confirm 'flatpak update
|
||||||
paru -Syu'
|
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
|
if set -q _flag_y
|
||||||
set --append cmds $noconfirm
|
set --append cmds (string split \n -- $noconfirm | string trim)
|
||||||
sudo -v
|
sudo -v
|
||||||
else
|
else
|
||||||
set --append cmds $confirm
|
set --append cmds (string split \n -- $confirm | string trim)
|
||||||
end
|
end
|
||||||
echo Commands to be run:
|
echo Commands to be run:
|
||||||
for i in $cmds
|
for i in $cmds
|
||||||
echo $i
|
echo $i
|
||||||
end
|
end
|
||||||
return 0
|
|
||||||
function execute -a cmds
|
function execute
|
||||||
argparse i/interactive -- $argv
|
argparse i/interactive -- $argv
|
||||||
if set -ql _flag_i
|
if set -ql _flag_i
|
||||||
for cmd in $cmds
|
for cmd in $cmds
|
||||||
|
@ -43,15 +44,15 @@ paru -Syu'
|
||||||
end
|
end
|
||||||
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
|
while read --nchars 1 -l response --prompt-str="Run on multiple terminals? (y/n)" or return 1
|
||||||
switch $response
|
switch $response
|
||||||
case y Y
|
case y Y
|
||||||
execute --interactive $cmds
|
execute --interactive
|
||||||
wait
|
wait
|
||||||
break
|
break
|
||||||
case n N
|
case n N
|
||||||
execute $cmds
|
execute
|
||||||
break
|
break
|
||||||
case '*'
|
case '*'
|
||||||
echo Invalid input!
|
echo Invalid input!
|
||||||
|
@ -59,6 +60,6 @@ paru -Syu'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
execute $cmds
|
execute
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue