2024-03-16 15:34:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
2024-03-29 06:50:32 +00:00
|
|
|
trap 'clear' SIGINT
|
2024-03-16 15:34:40 +00:00
|
|
|
cat > /tmp/.dialogrc << EOL
|
|
|
|
# Item color
|
|
|
|
tag_color = (BLACK,WHITE,ON)
|
|
|
|
EOL
|
|
|
|
set +ex
|
2024-04-06 14:19:39 +00:00
|
|
|
action=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --menu "Choose the action for git" 10 40 0 'Add all && Commit && Push' 1 "Add all && Commit" 2 "Reset soft" 3 "Reset hard" 4 "Status" 5 "Clone submodules" 6)
|
2024-03-16 15:34:40 +00:00
|
|
|
|
|
|
|
#echo $action
|
|
|
|
#exit
|
|
|
|
|
|
|
|
if [[ $action == "Add all && Commit && Push" ]]; then
|
|
|
|
commit_message=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --title "$action" --inputbox "Enter the commit message:" 8 40)
|
2024-04-06 14:26:44 +00:00
|
|
|
git add .
|
2024-03-16 15:34:40 +00:00
|
|
|
git commit -"m $commit_message"
|
|
|
|
git push
|
2024-04-06 14:19:39 +00:00
|
|
|
elif [[ $action == "Add all && Commit" ]]; then
|
2024-03-16 15:34:40 +00:00
|
|
|
commit_message=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --title "$action" --inputbox "Enter the commit message:" 8 40)
|
2024-04-06 14:26:44 +00:00
|
|
|
git add .
|
2024-03-16 15:34:40 +00:00
|
|
|
git commit -"m $commit_message"
|
2024-04-06 14:26:44 +00:00
|
|
|
elif [[ $action == "Reset soft" ]]; then
|
|
|
|
if DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --yesno "Do you wanna soft reset git?" 10 40; then
|
|
|
|
git reset
|
|
|
|
fi
|
2024-04-06 14:19:39 +00:00
|
|
|
elif [[ $action == "Reset hard" ]]; then
|
2024-04-06 14:26:44 +00:00
|
|
|
if DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --yesno "Do you wanna hard reset git?" 10 40; then
|
|
|
|
git reset --hard
|
|
|
|
fi
|
2024-03-29 07:23:10 +00:00
|
|
|
elif [[ $action == "Status" ]]; then
|
|
|
|
git status
|
2024-04-06 14:19:39 +00:00
|
|
|
elif [[ $action == "Clone submodules" ]]; then
|
|
|
|
git submodule update --init --recursive
|
2024-03-16 15:34:40 +00:00
|
|
|
fi
|