ref: 64762c4727d812c669e6e9fc72d74bcc3a09c93b
dir: /show/
#!/bin/rc -e rfork ne fn gettags { for(a in $pathlist) if(test -s .task/$a) showlist=($showlist .task/$a) } fn pretty { awk ' BEGIN { total = 0 completed = 0 } NR == 1 { print $0 } # Checklist percentages /^\[[ x]\]/ { print $0 total++ if ($0 ~ /^\[x\]/) completed++ } END { if (total > 0) { percentage = (completed / total) * 100 printf("Completion: %.1f%% (%d/%d)\n", percentage, completed, total) } } ' $* } fn showtask { for(m in $showlist){ if (~ $#raw 1) cat $m if not cat $m | pretty } # TODO: Show child percentages } flagfmt='r:raw'; args='[tags ...]' eval `''{aux/getflags $*} || exec aux/usage showlist=() pathlist=$* @{ gettags showtask } || echo 'unable to show given tags:' $status >[1=2] exit ''