#! /usr/bin/awk -f # vim: noet # respl: a repetitive schedule programming langage # a constructive response to how mind-numbing web apps are. # comlete example for the documentation # <<. respl | sort -t+ -k2 | date -f- +%s # s jun 9 2pm; d+ 5; w* 4 # s jun 9 9am; d+ 5; w* 4 # the program: # say april 1 8pm # say/set the date is apr 1, 8pm # days+ 2 4 # or 2 days later or 4 days later # week* 2 # or the same weekdays for 2 more weeks # could be shorten like this # s april 1 8pm ; d+ 2 4 ; w* 2 # typical usecase is framadate datepoll generation # <<. respl | date -f- +%Y-%m-%d # s apr 1; w* 3 ; d+ 1 2 function too_old_for(ver) { print "respl is too old, update to version "ver | ">&2 cat" exit 1; } function printdates() { if (date) for ( cweek=0; cweek VERSION ) too_old_for($f) if (sub(/^ *s(ay)? */ ,"",$f)) { printdates(); date=$f ; hours=0; days=0; weeks=1 } else if (sub(/^ *h(ours)?[+] */ ,"",$f)) { hours=hours" "$f } else if (sub(/^ *d(ays)?[+] */ ,"",$f)) { days=days" "$f } else if (sub(/^ *w(week)?[*] */ ,"",$f)) { weeks=$f } } } END { printdates() }