aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/zsh-completion
blob: c5e653f42fefb1e63fdf5eaac49de80754fd832b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Set up command completion for zsh
#
fetchmailauthtypes=(password kerberos kerberos_v5)
fetchmailprotocols=(auto pop2 pop3 apop rpop kpop sdps imap imap-k4 imap-gss etrn)
function fetchmailformattedinterfaces ()
{ reply=(`ifconfig|perl -e '$/="";while(<>){s/[\r\n]//g;if(/^(\w+\d*).*inet addr:([\d\.]+)/){print "$1/$2\n";}}'`) }
function fetchmailcompctl ()
{ reply=(`awk '{ print $2 }' < ~/.fetchmailrc` `fetchmail --help 2>&1| cut -c 7-19 | sed "s/,//g"`) }
compctl -K fetchmailcompctl \
	-x "C[-1,-L|--logfile]" -f \
	-  "C[-1,-f|--fetchmailrc]" -f \
	-  "C[-1,-i|--idfile]" -f \
	-  "C[-1,-I|--interface]" -K fetchmailformattedinterfaces \
	-  "C[-1,-M|--monitor]" -K fetchmailformattedinterfaces \
	-  "C[-1,-p|--protocol]" -k fetchmailprotocols \
	-  "C[-1,-A|--auth]" -k fetchmailauthtypes \
	-  "c[-1,--plugin]" -m \
	-  "c[-1,--plugout]" -m \
	-- fetchmail
.si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/bin/sh
#
# growthplot -- plot the fetchmail project's growth as a function of time
#

# Get data from the NEWS file
timeseries >/tmp/growthplot$$
grep "^[0-9]" /tmp/growthplot$$ >/tmp/growthnumbers$$
grep "^[0-9.]*.[05].0	" /tmp/growthplot$$ >/tmp/growthmajors$$
sed '/^4.2.9/,$d' </tmp/growthnumbers$$ >/tmp/growthannounce$$

cat >/tmp/growthimage$$ <<EOF
set title "Fetchmail project growth history"
set xlabel 'Days since baseline'
set ylabel 'Participants'
set y2label 'Lines of code'
set ytics nomirror
set y2tics
set tics out
set autoscale y
set y2range [5000:50000]
set key bottom right box
set terminal png color

EOF

# OK, now write the event labels
(
	count=0
	lastday=0
        breakheight=510
	while read version legend
	do
		if [ "$version" = '%' ]
		then
			echo "# Associate $lastday to '$legend'"
			count=$((count+1))
		        lastday=$(($lastday-5))
			endy=$((breakheight+50+count*50))
			if ((endy>lasttotal))
			then
			    # Label over curve hanging right, arrow down
			    arrowhead=$((lasttotal+50))
			    echo "set label '$legend' at $lastday-10, $endy+15"
			else
			    # Label under curve hanging left, arrow up
			    arrowhead=$((lasttotal-5))
			    strlen=`python -c "print len('$legend')"`
			    lablen=$((strlen*22))
			    echo "set label '$legend' at $lastday-$lablen+10, $endy-15"
			fi
			echo set arrow \
				from $lastday, $endy \
				to $lastday, $arrowhead \
				head
		else
			set -- $legend
			size=$1 
			friends=$2
			announce=$3
			total=$4
			days=$5 
			date=$6
			lastday=$days
			lasttotal=$total
		fi
	done
) </tmp/growthplot$$ >>/tmp/growthimage$$ 

# OK, now write the major-release labels
(
	while read version size friends announce total days date
	do
	    echo "set arrow from $days, $total - 55 to $days, $total - 15 head"
	    echo "set label '$version' at $days - 5, $total - 65"
	done
) </tmp/growthmajors$$ >>/tmp/growthimage$$ 

cat >>/tmp/growthimage$$ <<EOF
plot [] [0:] '/tmp/growthnumbers$$' using 6:5 \
		title "Both lists" with points 3, \
     '/tmp/growthannounce$$' using 6:4 \
		title "fetchmail-announce" with points 5, \
     '/tmp/growthannounce$$' using 6:3 \
		title "fetchmail-friends" with points 2, \
     '/tmp/growthnumbers$$' using 6:2 axes x1y2 \
		title "Lines of code" with points 7
EOF

gnuplot /tmp/growthimage$$ >growth.png

rm -f /tmp/growth*

# growthplot ends here