-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgitman v0.3.bash
72 lines (50 loc) · 1.4 KB
/
gitman v0.3.bash
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
#!/bin/bash
#!/usr/bin/bash
# script_by Farhan Sadik
# script_ver 0.3.1
update_text="auto commit on $(date +'%d-%m-%Y %I:%M')"
function quit() {
echo
read -p "press any key to exit (q) is default: " quit_input
if [[ $quit_input == 'q' ]]; then {
sleep 0;
} else {
printf "[*] invalid input\n";
}; fi
}
while true
do {
clear; printf "Git Manager v0.3.1\nBy Farhan Sadik\n"; echo; git status; echo;
printf " [1] status\n"
printf " [2] auto add\n"
printf " [3] auto commit\n"
printf " [4] pull\n"
printf " [5] push\n"
printf " [6] log\n"
printf " [0] quit\n\n"
read -p "gitman # " input; echo
if [[ $input == 1 ]]; then {
# status
if git status ; then quit; fi
} elif [[ $input == 2 ]]; then {
# auto add
printf "[*] adding files \n"
if git add . ; then printf "[*] files has been added sucessfully \n" && quit; else printf "[*] failed to add\n"; fi;
} elif [[ $input == 3 ]]; then {
# commit
printf "[*] preparing auto commit\n"
if git commit -am "$update_text"; then quit; fi
} elif [[ $input == 4 ]]; then {
if git pull; then quit; fi
} elif [[ $input == 5 ]]; then {
if git push; then quit; fi
} elif [[ $input == 6 ]]; then {
if git log --oneline; then quit; fi
} elif [[ $input == 0 ]]; then {
printf "[*] exit \n[*] ok\n"
exit 0
} else {
printf "invalid input\n";
} fi
}
done