This repository has been archived by the owner on Oct 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-color.sh
82 lines (56 loc) · 2.24 KB
/
git-color.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
##################################################################################################
#
# Display stash details with colorized output.
#
# Author: Chr. Dek.
#
# Run this *.sh file from any git repo to display all stashes/details with weight-coloring-format
# 1-5 changes (blue)
# 5-15 changes (bright blue)
# 15-30 changes (green)
# 30-45 changes (bright yellow)
# 45-60 changes (yellow)
# 60-80 changes (light red)
# 80+ changes (red)
##################################################################################################
strong="$(tput bold)";
dim="$(tput dim)";
ul=`tput smul`
rescol=`tput sgr0`
echo "${ul}${strong}STASH LIST:${rescol}"
echo ""
git stash list >> ~/Desktop/out.txt
sed -E 's/(:){1}[[:print:]]+//' < ~/Desktop/out.txt > ~/Desktop/st-out.txt ; rm ~/Desktop/out.txt
while read line
do
stashout=`echo $line`
execstash="$(git stash show ${stashout})"
changenum=`echo ${execstash} | grep "changed, " | sed -e "s/[^0-9|^,]//g" -e "s/,/\n/g" | sed '2q;d'`
echo ${strong}"STASH NUM - ${stashout}"
if [[ "$changenum" -ge 1 ]] && [[ "$changenum" -le 5 ]] ; then
echo ${execstash} | sed -e $'s/\(changed\, \)/\033[0;44m/' -e "s/\( \)/$rescol\1/"
fi
if [[ "$changenum" -ge 5 ]] && [[ "$changenum" -le 15 ]] ; then
echo ${execstash} | sed -e $'s/\(changed\, \)/\033[0;104m/' -e "s/\( \)/$rescol\1/"
fi
if [[ "$changenum" -ge 15 ]] && [[ "$changenum" -le 30 ]] ; then
echo ${execstash} | sed -e $'s/\(changed\, \)/\033[0;42m/' -e "s/\( \)/$rescol\1/"
fi
if [[ "$changenum" -ge 30 ]] && [[ "$changenum" -le 45 ]] ; then
echo ${execstash} | sed -e $'s/\(changed\, \)/\033[0;103m/' -e "s/\( \)/$rescol\1/"
fi
if [[ "$changenum" -ge 45 ]] && [[ "$changenum" -le 60 ]] ; then
echo ${execstash} | sed -e $'s/\(changed\, \)/\033[0;43m/' -e "s/\( \)/$rescol\1/"
fi
if [[ "$changenum" -ge 60 ]] && [[ "$changenum" -le 80 ]] ; then
echo ${execstash} | sed -e $'s/\(changed\, \)/\033[0;101m/' -e "s/\( \)/$rescol\1/"
fi
if [[ "$changenum" -ge 80 ]] ; then
echo ${execstash} | sed -e $'s/\(changed\, \)/\033[0;41m/' -e "s/\( \)/$rescol\1/"
fi
#echo ${execstash} | sed -e "s/\(changed\, \)/$setcolor\1/" -e "s/\( \)/$rescol\1/"
echo ${rescol}
done < ~/Desktop/st-out.txt
echo ${rescol}
rm ~/Desktop/st-out.txt