homes/common/.config/fish/functions/update-homes.fish

70 lines
1.8 KiB
Fish
Raw Normal View History

#!/usr/bin/env fish
function update-homes
2023-09-03 00:44:13 +02:00
argparse 'h/help' 'g/git' 'd/desktop' 'p/private' 'r/root' 'R/remove' 's/skip-secrets' -- $argv
if set --query _flag_help
echo "Update home's configuration"
echo
echo "You need to have homes and homes-private in your home directory."
echo "This function launch the two scripts to update your conf."
echo
echo " -g --git"
echo " Pull-rebase before launch script"
echo
echo " -d --desktop"
echo " Update desktop part"
echo
echo " -p --private"
echo " Update private part"
echo
echo " -r --root"
echo " Update root part"
echo
2023-09-03 00:44:13 +02:00
echo " -s --skip-secrets"
echo " Skip homes-private part"
echo
echo " -R --remove"
echo " Remove old configuration"
echo
echo " -h --help"
echo " Show this screen"
return
end
pushd ~/homes
if set --query _flag_git
gitpr
end
set -f options ""
if set --query _flag_desktop
set -f options "--desktop"
end
if set --query _flag_remove
set -f options "$options --remove"
end
if set --query _flag_root
set -f options "$options --root"
end
./update-home.fish $options
popd
2023-09-03 00:44:13 +02:00
if not set --query _flag_skip-secrets
pushd ~/homes-private
if set --query _flag_git
gitpr
end
2023-09-03 00:44:13 +02:00
set -f options ""
if set --query _flag_private
set -f options "--private"
end
if set --query _flag_root
set -f options "$options --root"
end
./update-private.fish $options
popd
end
end