dotfiles/taskwarrior/.local/share/task/hooks/DISABLED.on-exit.sync-to-server-silent.py
Marty Oehme 5ac9ca02f0
taskwarrior: Remove nagscreen and auto-sync
Removed nagscreen informing of 2.6.0 news that would periodically tell
you about 'new' things in taskwarrior by telling it i already saw it.

Removed perviously added auto-sync function. Two reasons:
The individual additions/modifications in taskwarrior take longer if
they need to be communicated to a server at the end of every change.
And undo does not work at all if we are already syncing to a server
after every change.
That means wrong changes are also synced and become really hard to
remove again.

So, it seems easier to, for now, sync manually after some commands and
before leaving one workstation for another. Another method of auto-sync
could be implemented but I have not found an elegant way.
2021-11-16 12:15:55 +01:00

29 lines
826 B
Python
Executable file

#!/usr/bin/env python3
# From: https://gist.github.com/varunagrawal/2b93c5dc721520ff6876e940c420ab05
# 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
sys.exit(0)
# no tasks to work through, don't error
if len(tasks) <= 0:
sys.exit(0)
# 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.Popen(["task", "rc.verbose=nothing", "rc.hooks=0", "sync"], close_fds=True)
sys.exit(0)