-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathgac.sh
56 lines (46 loc) · 1.15 KB
/
gac.sh
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
#!/bin/zsh
function gac() {
if [ $# -eq 0 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
# displays help with
# gac | gac -h | gac --help
echo "------"
echo "Cannot commit without comments. Semantic reminder:"
echo "chore: c"
echo "docs: d"
echo "feat: f"
echo "refactor: r"
echo "style: s"
echo "test: t"
echo "fix: x"
echo "------"
return 1
fi
SHORTCUT=$1
shift ;
COMMENT=$@
# Chore
if [ "$SHORTCUT" = "c" ]; then
SHORTCUT="chore:"
# Write or edit existing documentation
elif [ "$SHORTCUT" = "d" ]; then
SHORTCUT="docs:"
# Add new feature
elif [ "$SHORTCUT" = "f" ]; then
SHORTCUT="feat:"
# Refator your code base
elif [ "$SHORTCUT" = "r" ]; then
SHORTCUT="refactor:"
# Styling actions
elif [ "$SHORTCUT" = "s" ]; then
SHORTCUT="style:"
# Test your code
elif [ "$SHORTCUT" = "t" ]; then
SHORTCUT="test:"
# Working on a feature
elif [ "$SHORTCUT" = "x" ]; then
SHORTCUT="fix:"
fi
# res with or without semantic
git add -A && git commit -m "$SHORTCUT $COMMENT"
return 1
}