Lines 1-4
Link Here
|
1 |
#!/bin/sh |
1 |
#!/bin/sh |
|
|
2 |
if [ "$1" = "-m" ]; then |
3 |
shift; |
4 |
CODES="4:7:1:1" |
5 |
else |
6 |
CODES="1:34:31:35" |
7 |
fi |
2 |
(if [ "$1" != "" ]; then |
8 |
(if [ "$1" != "" ]; then |
3 |
while [ "$1" != "" ]; do |
9 |
while [ "$1" != "" ]; do |
4 |
case $1 in |
10 |
case $1 in |
Lines 13-32
Link Here
|
13 |
done |
19 |
done |
14 |
else |
20 |
else |
15 |
cat |
21 |
cat |
16 |
fi) | perl -pe ' |
22 |
fi) | perl -p -mconstant=CODES,${CODES} -e ' |
|
|
23 |
($at, $m, $p, $c) = split /:/, CODES; |
17 |
while (s/\t/" " x (8 - ((length($`)-1) % 8))/e) {} |
24 |
while (s/\t/" " x (8 - ((length($`)-1) % 8))/e) {} |
18 |
s/^(\+.*)$/\033[31m$1\033[m/o; |
25 |
s/^(\+.*)$/\033[${p}m$1\033[0m/o; |
19 |
s/^(-.*)$/\033[34m$1\033[m/o |
26 |
s/^(-.*)$/\033[${m}m$1\033[0m/o |
20 |
if !s/^(--- \d+,\d+ ----.*)$/\033[1m$1\033[m/o; |
27 |
if !s/^(--- \d+,\d+ ----.*)$/\033[1m$1\033[0m/o; |
21 |
s/^(\*\*\* \d+,\d+ *\*\*\*.*)$/\033[1m$1\033[m/o; |
28 |
s/^(\*\*\* \d+,\d+ *\*\*\*.*)$/\033[1m$1\033[0m/o; |
22 |
s/^(\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*)$/\033[1m$1\033[m/o; |
29 |
s/^(\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*)$/\033[1m$1\033[0m/o; |
23 |
s/^(!.*)$/\033[35m$1\033[m/o; |
30 |
s/^(!.*)$/\033[${c}m$1\033[0m/o; |
24 |
s/^(@@.*$)/\033[1m$1\033[m/o; |
31 |
s/^(@@.*$)/\033[${at}m$1\033[0m/o; |
25 |
if (/^1.(\d+)(\s+\(\w+\s+\d{2}-\w{3}-\d{2}\):\s)(.*)/) { |
32 |
if (/^1.(\d+)(\s+\(\w+\s+\d{2}-\w{3}-\d{2}\):\s)(.*)/) { |
26 |
$lastcol = $lastcol || 0; |
33 |
$lastcol = $lastcol || 0; |
27 |
$lastcol++ if defined($lastrev) && $lastrev != $1; |
34 |
$lastcol++ if defined($lastrev) && $lastrev != $1; |
28 |
$lastrev = $1; |
35 |
$lastrev = $1; |
29 |
$lastcol %= 6; |
36 |
$lastcol %= 6; |
30 |
$_ = "\033[3" . ($lastcol + 1) . "m1.$1$2\033[m$3\n"; |
37 |
$_ = "\033[3" . ($lastcol + 1) . "m1.$1$2\033[0m$3\n"; |
31 |
} |
38 |
} |
32 |
' | less -R |
39 |
' | less -R |