Skip to content

Commit

Permalink
taskwarrior: Add format
Browse files Browse the repository at this point in the history
  • Loading branch information
lasers committed Jan 11, 2017
1 parent d08de44 commit c220e9b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions py3status/modules/taskwarrior.py
Expand Up @@ -4,6 +4,10 @@
Configuration parameters:
cache_timeout: how often we refresh this module in seconds (default 5)
format: string to print (default '{task}')
Format placeholders:
{task} to-do list of active tasks
Requires
task: https://taskwarrior.org/download/
Expand All @@ -23,6 +27,7 @@ class Py3status:
"""
# available configuration parameters
cache_timeout = 5
format = '{task}'

def taskWarrior(self):
command = 'task start.before:tomorrow status:pending export'
Expand All @@ -33,11 +38,10 @@ def describeTask(taskObj):
return str(taskObj['id']) + ' ' + taskObj['description']

result = ', '.join(map(describeTask, tasks_json))
response = {
return {
'cached_until': self.py3.time_in(self.cache_timeout),
'full_text': result
'full_text': self.py3.safe_format(self.format, {'task': result})
}
return response


if __name__ == "__main__":
Expand Down

0 comments on commit c220e9b

Please sign in to comment.