Browse Source

replace g with the current version

Ondřej Hruška 1 year ago
parent
commit
8913dbd007
1 changed files with 54 additions and 6 deletions
  1. 54 6
      g

+ 54 - 6
g View File

@@ -24,7 +24,7 @@ function _pull {
24 24
 function _send {
25 25
 
26 26
 	_status
27
-	
27
+
28 28
 	if [ -z "`git status --porcelain`" ]
29 29
 		then
30 30
 			echo -e "\e[0;31m Nothing to commit.\e[0m"
@@ -64,6 +64,44 @@ function _send {
64 64
 }
65 65
 
66 66
 
67
+function _stage {
68
+
69
+	_status
70
+
71
+	if [ -z "`git status --porcelain`" ]
72
+		then
73
+			echo -e "\e[0;31m Nothing to commit.\e[0m"
74
+			echo
75
+			exit
76
+	fi
77
+
78
+
79
+	echo -e "\e[0;32m Going to ADD all and COMMIT.\e[0m"
80
+	echo -e "\e[0;32m Enter commit message (leave blank to abort).\e[0m"
81
+	echo
82
+	echo -n -e "\e[1;36m [msg]: \e[0m"
83
+	read msg
84
+	echo
85
+
86
+	if [ -z "$msg" ]
87
+		then
88
+			echo -e "\e[0;31m Aborted.\e[0m"
89
+			echo
90
+			exit
91
+	fi
92
+
93
+	echo -e "\e[0;33m> git add --all\e[0m"
94
+	echo
95
+	git add --all
96
+	echo
97
+
98
+	echo -e "\e[0;33m> git commit -m \"$msg\"\e[0m"
99
+	echo
100
+	git commit -m "$msg"
101
+	echo
102
+}
103
+
104
+
67 105
 case $1 in
68 106
 		"check" | "status")
69 107
 			_status
@@ -72,13 +110,23 @@ case $1 in
72 110
 		"pull")
73 111
 			_pull
74 112
 			;;
75
-			
76
-		"send" | "push")
113
+
114
+		"send")
77 115
 			_send
78 116
 			;;
79 117
 
80
-		*)
81
-			echo -e "\n\e[0;31m Invalid ACTION '$1', use one of {check, pull, send} !\e[0m\n";
118
+		"push")
119
+			echo -e "\e[0;33m> git push\e[0m"
120
+			echo
121
+			git push
122
+			echo
123
+			;;
124
+
125
+		"stage" | "commit" | "add")
126
+			_stage
82 127
 			;;
83 128
 
84
-	esac
129
+		*)
130
+			echo -e "\n\e[0;31m Invalid ACTION '$1', use one of {check/status, pull, send, push, stage/commit} !\e[0m\n";
131
+			;;
132
+esac