]> 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:

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