]> git.armaanb.net Git - asd-repo.git/commitdiff
kiss-mail: Colorize and cleanup UI.
authorArmaan Bhojwani <me@armaanb.net>
Tue, 23 Feb 2021 02:11:35 +0000 (21:11 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Tue, 23 Feb 2021 02:14:22 +0000 (21:14 -0500)
Closes #2

kiss-mail/checksums
kiss-mail/files/kiss-mail

index 554628494b11d471dab9d97b077d44212992c76c..34b64ebc20804d9c52092858b57e73b1d2b51efd 100644 (file)
@@ -1 +1 @@
-2660403c7aaf6835fb167025745e18445b1cc4b535dd8682c0c7d1afa5e66206
+6e7ef02e9f6751ffac447513bd217af87c0ab34232033bad60411547efa254f5
index 61e7848985b3b3e3073311bdffcfb5fb53b30327..ee2642fa50890f2445ed1fd18b276624dbcc431e 100755 (executable)
@@ -1,24 +1,31 @@
 #!/usr/bin/sh -e
 
+line() {
+  printf "%s++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" $blue
+}
+
 get_mail() {
   { IFS=:; set -- $KISS_PATH; unset IFS; }
   i=0
+  blue=$(tput setaf 4)
   for repo do
     git_root=$(git -C ${repo} rev-parse --show-toplevel)
     if [ -f ${git_root}/update ]; then
       shortlog=$(git -C ${git_root} log --pretty=oneline --follow -- update)
       while IFS= read -r line; do
-        hash=$(printf ${line} | cut -d " " -f 1)
+        hash=$(echo ${line} | cut -d " " -f 1)
         git -C ${git_root} show ${hash}:update | tail -n +2 > /tmp/kiss-mail
+        chmod +x /tmp/kiss-mail
 
-        printf "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
-        printf "Item:   %s" $((i = i + 1))
-        printf "\n"
-        git -C ${git_root} show -s ${hash} | tail -n +2
-        printf "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
-        /tmp/kiss-mail
-        printf "\n\n"
-
+        line
+        printf "%sItem:   %s\n" $blue $((i = i + 1))
+        git -C ${git_root} show -s ${hash} | \
+          awk -v blue="$blue" 'NR > 1 && NR < 4 {printf "%s%s\n", blue, $0}'
+        git -C ${git_root} log --format=${blue}"Topic:  "%B -n 1 ${hash} | \
+          head -n 1
+        line
+        /tmp/kiss-mail | awk '{print}'  # This normalizes the trailing newlines
+        echo
       done << EOF
       ${shortlog}
 EOF
@@ -27,3 +34,4 @@ EOF
 }
 
 get_mail | ${PAGER:-less -R}
+rm /tmp/kiss-mail