X-Git-Url: http://git.plutz.net/?p=busy;a=blobdiff_plain;f=templates%2FTasks.page;fp=templates%2FTasks.page;h=423dec3af73edcdb55b64a113615349f9b668cbf;hp=0000000000000000000000000000000000000000;hb=f485895094cd72318b46f39689c3ba954eb37411;hpb=904730d1782749bfac15b0344fe5782433f3099b diff --git a/templates/Tasks.page b/templates/Tasks.page new file mode 100644 index 0000000..423dec3 --- /dev/null +++ b/templates/Tasks.page @@ -0,0 +1,122 @@ +#!/bin/zsh + +show_search(){ + if [ -n "$search" ]; then + echo "

Tasks search results for: $search

" + for each in $(grep -ile "$search" Tasks/<0000000000-9999999999>_<000-999>); do + id=$(sed -r 's:^.*/::;s:.task$::' <<<$each) + echo "' + done + echo '
' + fi +} + +show_task(){ + datafile="Tasks/$info" + metafile="Tasks/$info.meta" + headline="$(sed -rn '/^headline=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")" + taskstatus="$(sed -rn '/^status=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")" + section="$(sed -rn '/^section=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")" + attendant="$(sed -rn '/^attendant=/{s:^[a-z]+=(.+)$:\1:p;q}' "$metafile")" + [ -z "$section" ] && section='(none)' + [ -z "$attendant" ] && attendant='(none)' + cat < +
+

$headline

+ $(_wiki "$datafile") +
+ + + + +
Status
+ $taskstatus
Section
+ $section
Attendant
+ $attendant
+ +TasksEND +} + +setup_taks(){ + cat < +

$new

+ + +
+ Description:
+ +
+ Section:
+
+ other section:
+ + + + +
+ +TaskEnd +} + +list_tasks(){ + stat -c '' Tasks/<0000000000-9999999999>_<000-999>.meta \ + && for each in Tasks/<0000000000-9999999999>_<000-999>.meta(.om); do + info="$(basename "$each" |sed 's:.meta$::')" + headline="$(sed -rn '/^headline=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")" + taskstatus="$(sed -rn '/^status=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")" + section="$(sed -rn '/^section=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")" + attendant="$(sed -rn '/^attendant=/{s:^[a-z]+=(.+)$:\1:p;q}' "$each")" + [ -z "$section" ] && section='(none)' + [ -z "$attendant" ] && attendant='(none)' + cat < + $headline
+ Status: $taskstatus + Section: $section + Attendant: $attendant + +TasksEND + done +} + +new_task(){ + cat <New Task + +TasksEND +} + +cat < +
+ +
+ +
+
+ $(show_search) +
+ + $([ -n "$info" -a -r "Tasks/$info" -a -r "Tasks/$info.meta" ] && show_task) + $([ -z "$info" -a -n "$new" ] && setup_task) + $([ -z "$info" -a -z "$new" ] && list_tasks) +
+TasksEND