sfeedhook

Call function on new feeds fetched with sfeed_update
git clone git://jacobedwards.org/sfeedhook
Log | Files | Refs | README

sfeedrc (597B)


      1 # An example sfeedrc using the 'new' hook
      2 
      3 . "$HOME"/.sfeed/sfeednew
      4 
      5 # sfeedtmpdir isn't defined until just after loading the sfeedrc,
      6 # so this delays referencing sfeedtmpdir until it's been defined.
      7 begin() {
      8 	mail="$sfeedtmpdir"/mail
      9 	export mail
     10 }
     11 
     12 new() {
     13 	awk -vname="$1" -F '	' '{
     14 		if (!title) {
     15 			printf "New in %s:\n\n", name
     16 			title = 1
     17 		}
     18 		printf "- %s\n", $2
     19 	}
     20 	END {
     21 		if (title)
     22 			printf "\n"
     23 	}' >> "$mail"
     24 }
     25 
     26 end() {
     27 	test -s "$mail" &&
     28 		mail -s 'sfeed_update: New feed items' "$(whoami)" < "$mail"
     29 }
     30 
     31 xargs() {
     32 	command xargs "$@"
     33 	end
     34 }
     35 
     36 feeds() {
     37 	begin
     38 	# feed ...
     39 }
     40