mirror of
https://github.com/GothenburgBitFactory/task-timewarrior-hook.git
synced 2025-06-26 10:54:27 +02:00
extensions: Make extensions conform with PEP8
This commit is contained in:
parent
339b849fff
commit
75be890476
1 changed files with 10 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
################################################################################
|
||||
###############################################################################
|
||||
#
|
||||
# Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez.
|
||||
#
|
||||
|
@ -23,7 +23,7 @@
|
|||
#
|
||||
# http://www.opensource.org/licenses/mit-license.php
|
||||
#
|
||||
################################################################################
|
||||
###############################################################################
|
||||
|
||||
import sys
|
||||
import json
|
||||
|
@ -45,28 +45,28 @@ print(json.dumps(new))
|
|||
tags = [new['description']]
|
||||
|
||||
if 'project' in new:
|
||||
project = new['project']
|
||||
tags.append(project)
|
||||
if '.' in project:
|
||||
tags.extend([tag for tag in project.split('.')])
|
||||
project = new['project']
|
||||
tags.append(project)
|
||||
if '.' in project:
|
||||
tags.extend([tag for tag in project.split('.')])
|
||||
|
||||
if 'tags' in new:
|
||||
tags.extend(new['tags'])
|
||||
tags.extend(new['tags'])
|
||||
|
||||
combined = ' '.join(['"%s"' % tag for tag in tags]).encode('utf-8').strip()
|
||||
|
||||
# Started task.
|
||||
if 'start' in new and not 'start' in old:
|
||||
os.system('timew start ' + combined.decode() + ' :yes')
|
||||
os.system('timew start ' + combined.decode() + ' :yes')
|
||||
|
||||
# Stopped task.
|
||||
elif not 'start' in new and 'start' in old:
|
||||
os.system('timew stop ' + combined.decode() + ' :yes')
|
||||
os.system('timew stop ' + combined.decode() + ' :yes')
|
||||
|
||||
# TI-51 - in the taskwarrior hook, deleting a task doesn't stop the watch
|
||||
#
|
||||
# Broadened to: Any task that is active, with a non-pending status should not
|
||||
# be tracked.
|
||||
elif 'start' in new and new['status'] != 'pending':
|
||||
os.system('timew stop ' + combined.decode() + ' :yes')
|
||||
os.system('timew stop ' + combined.decode() + ' :yes')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue