implement update -y option
This commit is contained in:
parent
205f0b0b88
commit
7c6ca9dc76
23
update.sh
23
update.sh
@ -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
|
Loading…
x
Reference in New Issue
Block a user