diff --git a/update.sh b/update.sh index 16f192b..c7aca86 100755 --- a/update.sh +++ b/update.sh @@ -4,13 +4,22 @@ cd ~/.dotfiles echo "Checking for dotfile updates..." git fetch -if [ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]; +if [ $(git rev-parse HEAD) != $(git rev-parse @{u}) ] then - read -p "Dotfiles can be updated. Do you want to proceed? (y/n)" choice - case "$choice" in - y|Y ) echo "Updating..." && git pull >> /dev/null && echo "Updated successfully";; - * ) echo "Skipping";; - esac + if [ "$1" == -y ] + then + echo "Updating..." + git pull >> /dev/null + 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 echo "Dotfiles are up-to-date" -fi; \ No newline at end of file +fi \ No newline at end of file