]> git.madduck.net Git - etc/taskwarrior.git/blob - README.rst

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Add a couple of simple tests and fix typo
[etc/taskwarrior.git] / README.rst
1 tasklib
2 =======
3
4 A Python library for interacting with taskwarrior_ databases.
5
6 Requirements
7 ------------
8
9 Before installing ``tasklib``, you'll need to install taskwarrior_.
10
11 Installation
12 ------------
13
14 Install via pip::
15
16     pip install tasklib
17
18 Usage
19 -----
20
21 .. source-code:
22
23     >>> from tasklib.task import TaskWarrior
24
25     >>> tw = TaskWarrior('/home/rob/.task')
26     >>> tasks = tw.tasks.pending()
27     >>> tasks
28     ['Tidy the house', 'Learn German']
29     >>> tasks.filter(tags__contain='chores')
30     ['Tidy the house']
31     >>> type(tasks[0])
32     <class 'tasklib.task.Task'>
33     >>> task[0].done()
34
35 Filtering Tasks
36 ---------------
37
38 Tasks can be filtered using the ``TaskQuerySet`` API which emulates the
39 Django ORM::
40
41     >>> tw.tasks.filter(status='pending', tags__contain='work')
42     ['Upgrade Ubuntu Server']
43
44 Filter arguments are passed to the ``task`` command (``__`` is replaced by
45 a period); so the above example is equivalent to the following command::
46
47     $ task status:pending tags.contain=work
48
49 .. _taskwarrior: http://taskwarrior.org
50
51 Tasks can also be filtered using raw commands, like so::
52
53     >>> tw.tasks.filter('status:pending +work')
54     ['Upgrade Ubuntu Server']