generated from UnBArqDsw/RepositorioTemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommit
executable file
·113 lines (83 loc) · 3.58 KB
/
commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
# paxmmit V3
# Create message with proper reference to rep issue based on branch name ddd_issueName
# Then add all changes in unstaged and commit with the respective message
# Author: Rogério Júnior
if [ ! -z "$1" -a "$1" != " " ]; then
bold=$(tput bold)
normal=$(tput sgr0)
declare number
number=$(git branch | grep '*' | sed 's/.*\([0-9]\{3\}\).*/\1/')
if [ $number -eq $number 2> /dev/null ]; then
number=$number
else
echo -e "${bold}@@@@@@@@@@@@@@@@@@@@@@@@@@@ W A R N I N G @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@${normal}"
echo -e "\nYou're out of a issue branch, the only way of contibuiting to iGado Org! :X "
echo -e "\nAre you ${bold}absolutely${normal} certain to try to commit in ${bold}$(git branch | grep '*' | sed 's|[*]||g')${normal} ? \n"
read -p "(${bold}y/n${normal}) " flag
if [ $flag == "n" ]; then
exit 1
fi
echo ""
read -p "What's the ${bold}issue number${normal}? " number
echo ""
fi
message="UnBArqDsw/2020.1_G13_Projeto#$number "
declare -a emoji_map
emoji_map[0]="‼️ BREAKING: "
emoji_map[1]="🐛 FIX: "
emoji_map[2]="👌 IMPROVE: "
emoji_map[3]="📖 DOC: "
emoji_map[4]="📦 NEW: "
emoji_map[5]="🤖 TEST: "
echo "What is the nature of this ${bold}commit${normal}? "
echo ""
read -p "(${bold}0${normal})-> ‼️ BREAKING //// (${bold}1${normal})-> 🐛 FIX ////(${bold}2${normal})-> 👌 IMPROVE ////(${bold}3${normal})-> 📖 DOC ////(${bold}4${normal})-> 📦 NEW ////(${bold}5${normal})-> 🤖 TEST: " emoji
message+="${emoji_map[${emoji}]} ${1}"
read -p "Are you ${bold}pairing${normal}? (${bold}y/n${normal}) " pairing
echo ""
if [ $pairing != "n" ]; then
declare -a map
# map=[["c"]="Co-authored-by: Caio Fernandes <[email protected]>" ["l"]="Co-authored-by: Lucas Fellipe <[email protected]>" ["g"]="Co-authored-by: Guilherme Mendes <[email protected]>" ["j"]="Co-authored-by: João Guedes <[email protected]>" ["i"]="Co-authored-by: Iuri Severo <[email protected]>"]]
map[0]="Co-authored-by: Caio Fernandes <[email protected]>"
map[1]="Co-authored-by: Lucas Fellipe <[email protected]>"
map[2]="Co-authored-by: Guilherme Mendes <[email protected]>"
map[3]="Co-authored-by: João Guedes <[email protected]>"
map[4]="Co-authored-by: Iuri Severo <[email protected]>"
declare flag="y"
message+="\n"
while [ $flag != 'n' ]; do
echo -e "With who?\n"x
read -p "(${bold}0${normal})Caio/(${bold}1${normal})Luquita/(${bold}2${normal})Guilherme/(${bold}3${normal})Johnson/(${bold}4${normal})Iuri " pairing_name
echo ""
echo ${pairing_name}
message+="\n${map[${pairing_name}]}"
read -p "Anyone else? (${bold}y/n${normal}) " flag
echo ""
done
fi
echo -e "That's the correct message ?\n\n\n$message\n\n"
read -p "(${bold}y/n${normal}): " flag
if [ $flag != 'n' ]; then
echo ""
read -p "What do you want do stage? (${bold}e${normal})verything/(${bold}s${normal})omethings/(${bold}n${normal})othing " flag
echo ""
if [ $flag == 'e' ]; then
git add .
else
if [ $flag == 's' ]; then
echo -e "Let's ${bold}stage${normal} the changes!\n\n"
git add -i
echo ""
fi
fi
git commit -m"$(echo -e $message)"
echo -e "\n\n"
echo -e "${bold}Everything commited!! ;)"
else
echo -e "\n\n"
echo "${bold}Run me again! :("
fi
else
echo -e "Wheres the message?! Run me again"
fi