From 86ebef1e06b2b43e2e15ac1e370a05ea87ab4f2f Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Sun, 7 Jun 2020 00:12:52 +0200 Subject: documentation and comments. Resolves https://github.com/tobixen/calendar-cli/issues/65 --- examples/task-management-examples | 92 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 examples/task-management-examples (limited to 'examples/task-management-examples') diff --git a/examples/task-management-examples b/examples/task-management-examples new file mode 100644 index 0000000..4bdc708 --- /dev/null +++ b/examples/task-management-examples @@ -0,0 +1,92 @@ +## This was my daily task management workflow for a while. + +## Eventually I'd like to make calendar-cli easier to use, so some of the "external logic" in those examples will eventually be moved into the tool itself. Anyway, some of the power of having a command-line utility is that it's possible to do just anything ... + +[ -z "$EDITOR" ] && EDITOR=vi + +echo "Enter a category or enter for all:" +read category +if [ -n "$category" ] +then + selflags="--categories=$category" +fi + +## Take out a personal agenda from different calendar sources: + +echo "Here is your upcoming calendar events:" +for section in pir seb house default work holidays +do + calendar-cli --config-section $section calendar agenda --agenda-days 20 +done | sort + +echo -e "\nAnd here is your upcoming calendar tasks:" +for section in seb house default work-tasks pir-tasks +do + echo $section + calendar-cli --config-section $section todo $selflags --limit 10 --hide-parent list +done + + +## Interactively set categories on uncategorized tasks: +tempfile=$(mktemp) +calendar-cli todo --nocategories list --todo-template='calendar-cli todo --todo-uid={uid} edit --set-categories=foo # {summary}' > $tempfile +if [ -s $tempfile ] +then + ## We have non-categorized tasks + echo -e "\nNext up: categorization of uncategorized tasks. Press enter" + read + tempfile2=$(mktemp) + ## Populate the tempfile with the list of categories first + calendar-cli todo list --list-categories | perl -pe 's/^/# /' > $tempfile2 + cat $tempfile >> $tempfile2 + while grep -q -- '--set-categories=foo ' $tempfile2 + do + $EDITOR $tempfile2 + done + . $tempfile2 + rm $tempfile2 +else + echo "No uncategorized todo-items on the calendar. Good!" +fi + + +## Interactively mark tasks as completed: +calendar-cli todo $selflags --hide-parents --limit 12 list --todo-template='# calendar-cli todo --todo-uid={uid} complete # {summary}' > $tempfile +## Exit if there aren't any tasks +if [ ! -s $tempfile ] +then + echo "No tasks available. Good?" + exit 0 +fi + +echo -e "\nNext up: Mark tasks that are completed as completed. Press enter" +read +$EDITOR $tempfile +. $tempfile + +## Set more realistic due-dates on overdue tasks +calendar-cli todo --overdue list --todo-template='calendar-cli todo --todo-uid={uid} postpone --due "in 15d" # {summary}' > $tempfile +if [ -s $tempfile ] +then + echo -e "\nNext up: Look over overdue tasks and consider procrastinating some of them. Press enter" + read + $EDITOR $tempfile + . $tempfile +fi + +## Clean the list a bit by procrastinating tasks (this includes the overdue) +calendar-cli todo --limit 10 --hide-future list --todo-template='calendar-cli todo --todo-uid={uid} postpone "in 4d" # {summary}' > $tempfile +if [ -s $tempfile ] +then + echo -e "\nNext up: Consider procrastinating the start-date of some of the tasks on your list. Press enter" + read + $EDITOR $tempfile + . $tempfile +fi + +## Simple sync of a google calendar into personal calendar +wget -O- https://www.google.com/calendar/ical/gsmk.gcal%40gmail.com/public/basic.ics | calendar-cli calendar addics + + +echo "Done!" + -- cgit v1.2.3