From 804022a199150d97c2b06c0821883d3e8d691a49 Mon Sep 17 00:00:00 2001 From: Rob Golding Date: Sun, 14 Apr 2013 21:31:12 +0100 Subject: [PATCH] Update docs to reflect new API --- README.rst | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 6cf60d6..28a61fb 100644 --- a/README.rst +++ b/README.rst @@ -20,15 +20,30 @@ Usage .. source-code: - >>> from tasklib.task import TaskWarrior, PENDING + >>> from tasklib.task import TaskWarrior >>> tw = TaskWarrior('/home/rob/.task') - >>> tasks = tw.get_tasks(status=PENDING) + >>> tasks = tw.tasks.pending() >>> tasks ['Tidy the house', 'Learn German'] + >>> tasks.filter(tags__contain='chores') + ['Tidy the house'] >>> type(tasks[0]) >>> task[0].done() +Filtering Tasks +--------------- + +Tasks can be filtered using the ``TaskQuerySet`` API which emulates the +Django ORM:: + + >>> tw.tasks.filter(status='pending', tags__contain='work') + ['Upgrade Ubuntu Server'] + +Filter arguments are passed to the ``task`` command (``__`` is replaced by +a period); so the above example is equivalent to the following command:: + + $ task status:pending tags.contain=work .. _taskwarrior: http://taskwarrior.org -- 2.39.2