Last active
September 4, 2021 16:59
-
-
Save varunagrawal/2b93c5dc721520ff6876e940c420ab05 to your computer and use it in GitHub Desktop.
Script to sync Taskwarrior after each operation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# This hooks script syncs task warrior to the configured task server. | |
# The on-exit event is triggered once, after all processing is complete. | |
# Make sure hooks are enabled and this hook script is executable. | |
# Run `task diag` for diagnostics on the hook. | |
import sys | |
import json | |
import subprocess | |
try: | |
tasks = json.loads(sys.stdin.readline()) | |
except: | |
# No input | |
pass | |
# Call the `sync` command | |
# hooks=0 ensures that the sync command doesn't call the on-exit hook | |
# verbose=nothing sets the verbosity to print nothing at all | |
subprocess.call(["task", "rc.hooks=0", "rc.verbose=nothing", "sync"]) | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment