-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpaxmmit
executable file
·99 lines (75 loc) · 3.22 KB
/
paxmmit
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
#!/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 Pax Org! :X "
echo -e "\nAre you ${bold}absolutely${normal} certain to try to commit in ${bold}$(git branch | grep '*' | sed 's|[*]||g')${normal} ? (it maybe be ${bold}refused${normal} on Github)\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="pax-app/Wiki#$number $1"
read -p "Are you ${bold}pairing${normal}? (${bold}y/n${normal}) " pairing
echo ""
if [ $pairing != "n" ]; then
declare -A map
map["a"]="Co-authored-by: Gabriel Albino <[email protected]>"
map["d"]="Co-authored-by: Lucas Dutra <[email protected]>"
map["e"]="Co-authored-by: Esio Freitas <[email protected]>"
map["fa"]="Co-authored-by: Fabiana Ribas <[email protected]>"
map["fe"]="Co-authored-by: Felipe Campos <[email protected]>"
map["k"]="Co-authored-by: Kaique Borges <[email protected]>"
map["mar"]="Co-authored-by: Marcos Nery <[email protected]>"
map["mat"]="Co-authored-by: Matheus Pimenta <[email protected]>"
map["r"]="Co-authored-by: Rogério Júnior <[email protected]>"
map["y"]="Co-authored-by: Youssef Muhamad <[email protected]>"
declare flag="y"
message+="\n"
while [ $flag != 'n' ]; do
echo -e "With who?\n"
read -p "(${bold}a${normal})lbino/(${bold}d${normal})utra/(${bold}e${normal})sio/(${bold}fa${normal})bi/(${bold}fe${normal})pas/(${bold}k${normal})aique/(${bold}mar${normal})cos/(${bold}mat${normal})heus/(${bold}r${normal})oger/(${bold}y${normal})oussef " pairing_name
echo ""
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