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,6 +181,11 @@ _bash-it_update() {
|
|||
status="$(git rev-list master..${BASH_IT_REMOTE}/master 2> /dev/null)"
|
||||
|
||||
if [[ -n "${status}" ]]; then
|
||||
git log --merges --format="%h: %b (%an)" master..${BASH_IT_REMOTE}/master
|
||||
echo ""
|
||||
read -e -n 1 -p "Would you like to update to $(git log -1 --format=%h origin/master)? [Y/n] " RESP
|
||||
case $RESP in
|
||||
[yY]|"")
|
||||
git pull --rebase &> /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo "Bash-it successfully updated."
|
||||
|
|
@ -193,6 +198,14 @@ _bash-it_update() {
|
|||
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
|
||||
echo "Bash-it is up to date, nothing to do!"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue