3 # Author: Srikanth Sastry (sastry@csail.mit.edu)
6 # This hook runs `task sync` in the background at the start of each task command, except
9 # Usage: simply copy this file to ~/.tasks/hooks, or whatever your hooks directory is
10 # as specified in you taskrc file.
12 # Compatibility: This hook uses the Hooks V2 API (https://taskwarrior.org/docs/hooks2.html)
13 # So, it works with TaskWarrior 2.4.3+
18 from subprocess
import Popen
, PIPE
23 arg_pair
= arg
.split(':')
24 if len(arg_pair
) != 2:
26 arg_map
[arg_pair
[0]] = arg_pair
[1]
28 if arg_map
.get('command', '') == 'synchronize':
31 process
= Popen(['task', 'synchronize', 'rc.hooks=off'], stdout
=PIPE
, stderr
=PIPE
)
32 print("Synchronizing in the background")