summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Brox <tobias@redpill-linpro.com>2018-12-11 10:16:09 +0100
committerTobias Brox <tobias@redpill-linpro.com>2018-12-11 10:16:09 +0100
commit0b7009ab043ca108bf673c22057cbd31ee29cc52 (patch)
tree731613b1f337483d76b33096edc11ba59bc52465
parent82dd7c180775125ccf0fb6e133022e4bac1d8fe5 (diff)
parentbb12a1dc830b5837ac10328c6d90f3d62342bcd3 (diff)
downloadcalendar-cli-0b7009ab043ca108bf673c22057cbd31ee29cc52.zip
Merge branch 'v0.11.0.dev'
I'm a bit confused, do we need a separate branch for v0.11.0.dev?
-rw-r--r--EXAMPLES85
l---------calendar-cli1
-rwxr-xr-xcalendar-cli.py6
l---------calendar_cli.py1
-rw-r--r--setup.py2
5 files changed, 82 insertions, 13 deletions
diff --git a/EXAMPLES b/EXAMPLES
index 4d5b375..97b7c8b 100644
--- a/EXAMPLES
+++ b/EXAMPLES
@@ -1,25 +1,92 @@
-TODO: clean this up a bit
+## 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 ...
-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 ...
+## TODO: still some hard-coded personal stuff in the script. Should move it out to a config section.
+
+[ -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:
-for section in pp seb house default work holidays ; do ./calendar-cli.py --config-section $section calendar agenda --agenda-days 20; done | sort ; for section in seb house default work-tasks pp-tasks ; do echo $section; ./calendar-cli.py --config-section $section todo --limit 10 --hide-parent list ; done ## AGENDA
+
+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:
-cd ~/calendar-cli/ ; { ./calendar-cli.py todo list --list-categories | perl -pe 's/^/# /' ; ./calendar-cli.py todo --nocategories list --todo-template='./calendar-cli.py todo --todo-uid={uid} edit --set-categories=foo # {summary}' ; } > /tmp/nocat ; $EDITOR /tmp/nocat ; . /tmp/nocat
+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:
-cd ~/calendar-cli/ ; { ./calendar-cli.py todo --hide-parents --limit 10 list --todo-template='# ./calendar-cli.py todo --todo-uid={uid} complete # {summary}' ; } > /tmp/tocomplete ; $EDITOR /tmp/tocomplete ; . /tmp/tocomplete
+calendar-cli todo $selflags --hide-parents --limit 10 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
-## Interactively mark tasks as completed, with category:
-CAT=keyboard ; cd ~/calendar-cli/ ; { ./calendar-cli.py todo --hide-parents --categories=$CAT --limit 10 list --todo-template='# ./calendar-cli.py todo --todo-uid={uid} complete # {summary}' ; } > /tmp/tocomplete ; $EDITOR /tmp/tocomplete ; . /tmp/tocomplete
+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
-cd ~/calendar-cli/ ; { ./calendar-cli.py todo --overdue list --todo-template='./calendar-cli.py todo --todo-uid={uid} postpone --due "in 2d" # {summary}' ; } > /tmp/toprocrastinate ; $EDITOR /tmp/toprocrastinate ; . /tmp/toprocrastinate
+calendar-cli todo --overdue list --todo-template='calendar-cli todo --todo-uid={uid} postpone --due "in 4d" # {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)
-cd ~/calendar-cli/ ; { ./calendar-cli.py todo --hide-future list --todo-template='./calendar-cli.py todo --todo-uid={uid} postpone "in 5d" # {summary}' ; } > /tmp/toprocrastinate ; $EDITOR /tmp/toprocrastinate ; . /tmp/toprocrastinate
+calendar-cli todo --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!"
+
diff --git a/calendar-cli b/calendar-cli
new file mode 120000
index 0000000..e3b7ab8
--- /dev/null
+++ b/calendar-cli
@@ -0,0 +1 @@
+calendar-cli.py \ No newline at end of file
diff --git a/calendar-cli.py b/calendar-cli.py
index 8c01e14..8368b69 100755
--- a/calendar-cli.py
+++ b/calendar-cli.py
@@ -35,7 +35,7 @@ import sys
import re
import urllib3
-__version__ = "0.11.0"
+__version__ = "0.11.0.dev0"
__author__ = "Tobias Brox"
__author_short__ = "tobixen"
__copyright__ = "Copyright 2013-2016, Tobias Brox"
@@ -796,8 +796,8 @@ def main():
todo_subparsers = todo_parser.add_subparsers(title='tasks subcommand')
todo_add_parser = todo_subparsers.add_parser('add')
todo_add_parser.add_argument('summaryline', nargs='+')
- todo_add_parser.add_argument('--set-due', default=date.today()+timedelta(365))
todo_add_parser.add_argument('--set-dtstart', default=date.today()+timedelta(1))
+ todo_add_parser.add_argument('--set-due', default=date.today()+timedelta(1))
todo_add_parser.add_argument('--is-child', help="the new task is a child-task of the selected task(s)", action='store_true')
for attr in vtodo_txt_one + vtodo_txt_many:
if attr != 'summary':
@@ -810,7 +810,7 @@ def main():
todo_list_parser = todo_subparsers.add_parser('list')
todo_list_parser.add_argument('--todo-template', help="Template for printing out the event", default="{dtstart}{dtstart_passed_mark} {due}{due_passed_mark} {summary}")
- todo_list_parser.add_argument('--default-due', help="Default number of days from a task is submitted until it's considered due", type=int, default=365)
+ todo_list_parser.add_argument('--default-due', help="Default number of days from a task is submitted until it's considered due", type=int, default=14)
todo_list_parser.add_argument('--list-categories', help="Instead of listing the todo-items, list the unique categories used", action='store_true')
todo_list_parser.add_argument('--timestamp-format', help="strftime-style format string for the output timestamps", default="%Y-%m-%d (%a)")
todo_list_parser.set_defaults(func=todo_list)
diff --git a/calendar_cli.py b/calendar_cli.py
new file mode 120000
index 0000000..e3b7ab8
--- /dev/null
+++ b/calendar_cli.py
@@ -0,0 +1 @@
+calendar-cli.py \ No newline at end of file
diff --git a/setup.py b/setup.py
index 2b3eaca..a843a49 100644
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,7 @@ setup(
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries",
],
- scripts=['calendar-cli.py'],
+ scripts=['calendar-cli.py', 'calendar-cli'],
install_requires=[
'icalendar',
'caldav>=0.5.0',