rohrpost

A commandline mail client to change the world as we see it.
git clone git://r-36.net/rohrpost
Log | Files | Refs | README | LICENSE

inc.sh (870B)


      1 #!/bin/bash
      2 
      3 reset="$(tput sgr0)"
      4 titleformat="$(tput bold)"
      5 folderformat="$(tput setaf 7)"
      6 msgsformat="$(tput setaf 3)"
      7 unseen0format=""
      8 unseenformat="$(tput setaf 7)"
      9 recentformat=""
     10 
     11 first=1
     12 
     13 while read line;
     14 do
     15 	folder=$(echo -n "$line" | cut -f 1 | head -c 25)
     16 	msgs=$(echo -n "$line" | cut -f 2 | head -c 16)
     17 	unseen=$(echo -n "$line" | cut -f 3 | head -c 16)
     18 	recent=$(echo -n "$line" | cut -f 4 | head -c 16)
     19 
     20 	if [ $first -eq 1 ];
     21 	then
     22 		printf "${titleformat}%25s  %16s  %16s  %16s${reset}\n" \
     23 			"$folder" "$msgs" "$unseen" "$recent"
     24 		first=0
     25 	else
     26 		printf "${folderformat}%25s${reset}  " "$folder"
     27 		printf "${msgsformat}%16s${reset}  " "$msgs"
     28 		if [ $unseen -eq 0 ];
     29 		then
     30 			printf "${unseen0format}%16s${reset}  " "$unseen"
     31 		else
     32 			printf "${unseenformat}%16s${reset}  " "$unseen"
     33 		fi
     34 		printf "${recentformat}%16s${reset}\n" "$recent"
     35 	fi
     36 done
     37