]> git.armaanb.net Git - asd-repo.git/blob - kiss-mail/files/kiss-mail
mutt: remove /etc/Mutt*
[asd-repo.git] / kiss-mail / files / kiss-mail
1 #!/usr/bin/sh -e
2
3 line() {
4   printf "%s++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" $blue
5 }
6
7 get_mail() {
8   { IFS=:; set -- $KISS_PATH; unset IFS; }
9   i=0
10   blue=$(tput setaf 4)
11   for repo do
12     git_root=$(git -C ${repo} rev-parse --show-toplevel)
13     if [ -f ${git_root}/update ]; then
14       shortlog=$(git -C ${git_root} log --pretty=oneline --follow -- update)
15       while IFS= read -r line; do
16         hash=$(echo ${line} | cut -d " " -f 1)
17         git -C ${git_root} show ${hash}:update | tail -n +2 > /tmp/kiss-mail
18         chmod +x /tmp/kiss-mail
19
20         line
21         printf "%sItem:   %s\n" $blue $((i = i + 1))
22         git -C ${git_root} show -s ${hash} | \
23           awk -v blue="$blue" 'NR > 1 && NR < 4 {printf "%s%s\n", blue, $0}'
24         git -C ${git_root} log --format=${blue}"Topic:  "%B -n 1 ${hash} | \
25           head -n 1
26         line
27         /tmp/kiss-mail | awk '{print}'  # This normalizes the trailing newlines
28         echo
29       done << EOF
30       ${shortlog}
31 EOF
32     fi
33   done
34 }
35
36 get_mail | ${PAGER:-less -R}
37 rm /tmp/kiss-mail