implement update -y option
This commit is contained in:
parent
205f0b0b88
commit
7c6ca9dc76
21
update.sh
21
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
|
||||
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
|
||||
case "$choice" in
|
||||
y|Y ) echo "Updating..." && git pull >> /dev/null && echo "Updated successfully";;
|
||||
* ) echo "Skipping";;
|
||||
esac
|
||||
if [ "$choice" = "y" ]
|
||||
then
|
||||
echo "Updating..."
|
||||
git pull >> /dev/null
|
||||
echo "Updated successfully"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Dotfiles are up-to-date"
|
||||
fi;
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user