]>
git.madduck.net Git - etc/taskwarrior.git/blobdiff - docs/index.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:
>>> tw = TaskWarrior(data_location='~/.task', create=True)
>>> tw = TaskWarrior(data_location='~/.task', create=True)
+The ``TaskWarrior`` instance will also use your .taskrc configuration (so that
+it recognizes the same UDAs as your task binary, uses the same configuration,
+etc.). To override the location of the .taskrc, use
+``taskrc_location=~/some/different/path``.
+
Creating Tasks
--------------
Creating Tasks
--------------
>>> t['due']
datetime.datetime(2015, 2, 1, 19, 44, 4, 770001, tzinfo=<DstTzInfo 'Europe/Berlin' CET+1:00:00 STD>)
>>> now.astimezone(pytz.utc)
>>> t['due']
datetime.datetime(2015, 2, 1, 19, 44, 4, 770001, tzinfo=<DstTzInfo 'Europe/Berlin' CET+1:00:00 STD>)
>>> now.astimezone(pytz.utc)
- datetime.datetime(2015, 2, 1, 18, 44, 4, 770001, tzinfo=<DstTzInfo 'Europe/Berlin' CET+1:00:00 STD >)
+ datetime.datetime(2015, 2, 1, 18, 44, 4, 770001, tzinfo=<UTC >)
>>> t['due'] == now.astimezone(pytz.utc)
True
>>> t['due'] == now.astimezone(pytz.utc)
True
Setting custom configuration values
-----------------------------------
Setting custom configuration values
-----------------------------------
-By default, TaskWarrior does not use any of configuration values stored in
-your .taskrc. To see what configuration valu es are passed to each executed
+By default, TaskWarrior uses configuration values stored in your .taskrc.
+To see what configuration value overrid es are passed to each executed
task command, have a peek into ``config`` attribute of ``TaskWarrior`` object::
>>> tw.config
{'confirmation': 'no', 'data.location': '/home/tbabej/.task'}
task command, have a peek into ``config`` attribute of ``TaskWarrior`` object::
>>> tw.config
{'confirmation': 'no', 'data.location': '/home/tbabej/.task'}
-To pass your own configuration, you just need to update this dictionary::
+To pass your own configuration overrides , you just need to update this dictionary::
>>> tw.config.update({'hooks': 'off'}) # tasklib will not trigger hooks
>>> tw.config.update({'hooks': 'off'}) # tasklib will not trigger hooks
Working with UDAs
-----------------
Working with UDAs
-----------------
-Since TaskWarrior does not read your .taskrc, you need to define any UDAs
-in the TaskWarrior's config dictionary, as described above.
-
-Let us demonstrate this on the same example as in the TaskWarrior's docs::
+Since TaskWarrior does read your .taskrc, you need not to define any UDAs
+in the TaskWarrior's config dictionary, as described above. Suppose we have
+a estimate UDA in the .taskrc::
- >>> tw = TaskWarrior()
- >>> tw.config.update({'uda.estimate.type': 'numeric'})
+ uda.estimate.type = numeric
-Now we can filter and create tasks using the estimate UDA ::
+We can simply filter and create tasks using the estimate UDA out of the box ::
>>> task = Task(tw, description="Long task", estimate=1000)
>>> task.save()
>>> task['id']
>>> task = Task(tw, description="Long task", estimate=1000)
>>> task.save()
>>> task['id']
$ task 1 export
{"id":1,"description":"Long task","estimate":1000, ...}
$ task 1 export
{"id":1,"description":"Long task","estimate":1000, ...}
-As long as ``TaskWarrior``'s config is updated, we can approach UDAs as built in attributes ::
+We can also speficy UDAs as arguments in the TaskFilter ::
>>> tw.tasks.filter(estimate=1000)
Long task
>>> tw.tasks.filter(estimate=1000)
Long task
-Syncing is not directly supported by tasklib, but it can be made to work in a similiar way
-as the UDAs. First we need to update the ``config`` dictionary by the values required for
-sync to work, and then we can run the sync command using the ``execute_command()`` method::
+If you have configurated the needed config variables in your .taskrc, syncing
+is as easy as::
+
+ >>> tw = TaskWarrior()
+ >>> tw.execute_command(['sync'])
+
+If you want to use non-standard server/credentials, you'll need to provide configuration
+overrides to the ``TaskWarrior`` instance. Update the ``config`` dictionary with the
+values you desire to override, and then we can run the sync command using
+the ``execute_command()`` method::
>>> tw = TaskWarrior()
>>> sync_config = {
>>> tw = TaskWarrior()
>>> sync_config = {