-
Notifications
You must be signed in to change notification settings - Fork 16
/
apply_it_from_email
executable file
·49 lines (37 loc) · 1.36 KB
/
apply_it_from_email
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
#!/bin/bash
# Text color variables
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
txtred=$(tput setaf 1) # Red
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue
txtpur=$(tput setaf 5) # Purple
txtcyn=$(tput setaf 6) # Cyan
txtwht=$(tput setaf 7) # White
txtrst=$(tput sgr0) # Text reset
TMPDIR="/home/gregkh/tmp"
EMAIL=$(mktemp ${TMPDIR}/apply_it.XXXXX) || exit 1
cat - > "${EMAIL}"
#COMMIT_ID=`cat - | ~/bin/get_commit_id.sh`
COMMIT_ID=$(cat "${EMAIL}" | grep -i "commit:" | head -n 1 | sed -s 's/ //g' | cut -f 2 -d ':')
if [ "${COMMIT_ID}" == "" ] ; then
# try to find it on the first line
COMMIT_ID=$(head -n 1 "${EMAIL}" | cut -f 2 -d ' ')
fi
rm "${EMAIL}"
if [ "${COMMIT_ID}" == "" ] ; then
echo "${txtred}commit id not found!${txtrst}"
exit 1
fi
echo "${txtgrn}$COMMIT_ID${txtrst}"
C2P=$(command -v c2p)
echo "${txtblu}c2p $COMMIT_ID${txtrst}"
#gnome-terminal --command="${C2P} $COMMIT_ID" --geometry=120x30 &
#gnome-terminal --command="${C2P} $COMMIT_ID" &
#terminology --geometry=120x30 --exec "${C2P} ${COMMIT_ID}" 2> /dev/null &
#tilix --geometry=120x30 --command="${C2P} ${COMMIT_ID}" 2> /dev/null &
#tilix --command="${C2P} ${COMMIT_ID}"
#kitty ${C2P} ${COMMIT_ID} &
kitty -o initial_window_width=200 -o initial_window_heigth=220 ${C2P} ${COMMIT_ID} 2> /dev/null &
exit