Improve taskwarrior sync setup

master
Hektor Misplon 2023-04-14 17:34:14 +02:00
parent f615055adb
commit 0cbab089bd
5 changed files with 61 additions and 14 deletions

1
.config/task/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
taskrc.d/server

View File

@ -1,7 +1,9 @@
data.location=~/.task data.location=~/.task
include ./taskrc.d/server
# Theme # Theme
include /usr/share/doc/task/rc/dark-gray-256.theme include /usr/share/doc/task/rc/light-256.theme
uda.reviewed.type=date uda.reviewed.type=date
uda.reviewed.label=Reviewed uda.reviewed.label=Reviewed
@ -10,18 +12,11 @@ report._reviewed.columns=uuid
report._reviewed.sort=reviewed+,modified+ report._reviewed.sort=reviewed+,modified+
report._reviewed.filter=( reviewed.none: or reviewed.before:now-6days ) and ( +PENDING or +WAITING ) report._reviewed.filter=( reviewed.none: or reviewed.before:now-6days ) and ( +PENDING or +WAITING )
taskd.certificate=/home/h/.task/private.certificate.pem
taskd.key=/home/h/.task/private.key.pem
taskd.ca=/home/h/.task/ca.crt
taskd.server=inthe.am:53589
taskd.credentials=inthe_am/hektor.misplon/2feb9351-d86a-4ecc-9a69-72ac391e15e6
taskd.trust=strict
# Changes to `all` report: # Changes to `all` report:
# #
# due->due.remaining # due->due.remaining
report.all.columns=id,status.short,uuid.short,start.active,entry.age,end.age,depends.indicator,priority,project.parent,tags.count,recur.indicator,wait.remaining,scheduled.remaining,due.remaining,until.remaining,description # report.all.columns=id,status.short,uuid.short,start.active,entry.age,end.age,depends.indicator,priority,project.parent,tags.count,recur.indicator,wait.remaining,scheduled.remaining,due.remaining,until.remaining,description
report.all.labels=ID,St,UUID,A,Age,Done,D,P,Project,Tags,R,Wait,Sch,Due,Until,Description # report.all.labels=ID,St,UUID,A,Age,Done,D,P,Project,Tags,R,Wait,Sch,Due,Until,Description
# Description report # Description report
report.description.columns=description report.description.columns=description
@ -29,7 +24,23 @@ report.description.columns=description
# Adjust defaults # Adjust defaults
alias.burndown=burndown.daily alias.burndown=burndown.daily
urgency.user.project.run.coefficient=0 # Set urgencies for certain projects
urgency.user.project.side.coefficient=-1.0 urgency.user.project.studies.coefficient=1.0
urgency.user.project.admin.coefficient=1.0
urgency.user.project.personal.coefficient=0.5
urgency.user.project.groceries.coefficient=0.5
urgency.user.project.home.coefficient=0.2
urgency.user.project.creative.coefficient=0.0
urgency.user.project.side.coefficient=0.0
verbose=blank,header,footnote,label,new-id,affected,edit,special,project,unwait # Set urgencies for certain tags
urgency.user.tag.money.coefficient=1.5
# Adjust urgencies for priorities
urgency.uda.priority.L.coefficient=-1.0
# verbose=blank,header,footnote,label,new-id,affected,edit,special,project,unwait
search.case.sensitive=no
context.cc.read=pro:studies.cc
context.cc.write=pro:studies.cc

14
.config/task/taskrc.d/setup.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Evaluate environment variables into `server` config file
source ~/.env
config_file=~/.config/task/taskrc.d/server
echo "taskd.certificate=~/.task/default-client.cert.pem" > $config_file
echo "taskd.key=~/.task/default-client.key.pem" >> $config_file
echo "taskd.ca=~/.task/ca.cert.pem" >> $config_file
echo "taskd.trust=ignore hostname" >> $config_file
echo "taskd.server=$TASKD_SERVER:$TASKD_PORT" >> $config_file
echo "taskd.credentials=$TASKD_CREDS" >> $config_file

3
.gitignore vendored
View File

@ -20,8 +20,9 @@ Desktop.ini
# Thumbnail cache # Thumbnail cache
Thumbs.db Thumbs.db
# Prerequisites # Prerequisites, but not directories
*.d *.d
!*.d/
# Object files # Object files
*.o *.o

20
.task/hooks/on-exit.sync.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# Inspired by https://gist.github.com/primeapple/d3d82fbd28e9134d24819dd72430888e
source ~/.env
log_file=~/.task/sync.log
is_up() {
if ! nc -z $TASKD_SERVER $TASKD_PORT; then
echo "Server is down" >> $log_file
exit 1
fi
}
is_up
date > $log_file
task rc.verbose:nothing sync >> $log_file &
exit 0