implement update -y option

This commit is contained in:
constantin 2024-09-04 19:33:39 +02:00
parent 205f0b0b88
commit 7c6ca9dc76

View File

@ -4,13 +4,22 @@ cd ~/.dotfiles
echo "Checking for dotfile updates..." echo "Checking for dotfile updates..."
git fetch git fetch
if [ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]; if [ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]
then then
read -p "Dotfiles can be updated. Do you want to proceed? (y/n)" choice if [ "$1" == -y ]
case "$choice" in then
y|Y ) echo "Updating..." && git pull >> /dev/null && echo "Updated successfully";; echo "Updating..."
* ) echo "Skipping";; git pull >> /dev/null
esac echo "Updated successfully"
else
read -p "Dotfiles can be updated. Do you want to proceed? (y/n) " choice
if [ "$choice" = "y" ]
then
echo "Updating..."
git pull >> /dev/null
echo "Updated successfully"
fi
fi
else else
echo "Dotfiles are up-to-date" echo "Dotfiles are up-to-date"
fi; fi