-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.bash
More file actions
42 lines (35 loc) · 1.17 KB
/
Copy pathtest.bash
File metadata and controls
42 lines (35 loc) · 1.17 KB
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
gitq_m = ''; # qgit -m (for message)
gitq_o = ''; # qgit -o (for origin)
gitq_y = ''; # qgit -y (for skip confirms)
alias qgit = function git_commit(){
# check flags
while getopts 'abd:v' flag; do
case "${flag}" in
m) gitq_m = "qgit @: $datetime";;
o) gitq_o = 'origin';;
y) gitq_y = '';;
*) error "unexpected option ${{flag}";;
if (gitq_m == ''){
datetime = $(date +'%Y-%m-%d %H:%M:%S')
gitq_m=$(echo 'qgit @: ' $datetime)
}
fi
esac
done
# if -y flag applied, then hard send
if(y == 'true'){
$(git add .); $(git commit -m `gitq_m`); $(git push -u `gitq_o`);
}
fi
else {
datetime = $(date +'%Y-%m-%d %H:%M:%S')
read -p "would you like to commit to: ${gitq_o} with the meddage: ${datetime} (y/n)"
select yn in "y" "n"; do
case $yn in
y) $(git add .); $(git commit -m `gitq_m`); $(git push -u `gitq_o`);;
n) exit;;
*) echo "incorrect input detected"
esac
done
}
}