Show update prompt when running bash-it update
This utilizes the body of the merged PR requests to show the commits that are included in this update. It gives the user a chance to decline the upgrades by pressing n or N.pull/1280/head
parent
e3a89c8ef1
commit
8e7a566d96
|
|
@ -181,18 +181,31 @@ _bash-it_update() {
|
||||||
status="$(git rev-list master..${BASH_IT_REMOTE}/master 2> /dev/null)"
|
status="$(git rev-list master..${BASH_IT_REMOTE}/master 2> /dev/null)"
|
||||||
|
|
||||||
if [[ -n "${status}" ]]; then
|
if [[ -n "${status}" ]]; then
|
||||||
git pull --rebase &> /dev/null
|
git log --merges --format="%h: %b (%an)" master..${BASH_IT_REMOTE}/master
|
||||||
if [[ $? -eq 0 ]]; then
|
echo ""
|
||||||
echo "Bash-it successfully updated."
|
read -e -n 1 -p "Would you like to update to $(git log -1 --format=%h origin/master)? [Y/n] " RESP
|
||||||
echo ""
|
case $RESP in
|
||||||
echo "Migrating your installation to the latest version now..."
|
[yY]|"")
|
||||||
_bash-it-migrate
|
git pull --rebase &> /dev/null
|
||||||
echo ""
|
if [[ $? -eq 0 ]]; then
|
||||||
echo "All done, enjoy!"
|
echo "Bash-it successfully updated."
|
||||||
bash-it reload
|
echo ""
|
||||||
else
|
echo "Migrating your installation to the latest version now..."
|
||||||
echo "Error updating Bash-it, please, check if your Bash-it installation folder (${BASH_IT}) is clean."
|
_bash-it-migrate
|
||||||
fi
|
echo ""
|
||||||
|
echo "All done, enjoy!"
|
||||||
|
bash-it reload
|
||||||
|
else
|
||||||
|
echo "Error updating Bash-it, please, check if your Bash-it installation folder (${BASH_IT}) is clean."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
[nN])
|
||||||
|
echo "Not upgrading…"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "\033[91mPlease choose y or n.\033[m"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
echo "Bash-it is up to date, nothing to do!"
|
echo "Bash-it is up to date, nothing to do!"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue