holy moly we're almost there
This commit is contained in:
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#! /usr/bin/env cached-nix-shell
|
||||
#! nix-shell -i python3 -p python3
|
||||
|
||||
"""Manage Taskwarrior notes"""
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import datetime
|
||||
|
||||
NOTES_DIR = "~/kitaab/vimwiki/task-notes"
|
||||
EDITOR = os.environ["EDITOR"]
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
|
||||
def write_note(task_id: int):
|
||||
"""Open `$EDITOR` to take notes about task with ID `task_id`."""
|
||||
task_uuid = os.popen(f"task _get {task_id}.uuid").read().rstrip()
|
||||
|
||||
if not task_uuid:
|
||||
logging.error(f"{task_id} has no UUID!")
|
||||
sys.exit(1)
|
||||
|
||||
logging.debug(f"Task {task_id} has UUID {task_uuid}")
|
||||
|
||||
notes_dir = os.path.expanduser(NOTES_DIR)
|
||||
os.makedirs(notes_dir, exist_ok=True)
|
||||
notes_basename = f"{task_uuid}.wiki"
|
||||
notes_file = os.path.join(notes_dir, notes_basename)
|
||||
logging.debug(f"Notes file is {notes_file}")
|
||||
|
||||
if not os.path.exists(notes_file):
|
||||
logging.info("Adding description to empty notes file")
|
||||
task_description = os.popen(f"task _get {task_id}.description").read()
|
||||
task_project = os.popen(f"task _get {task_id}.project").read().strip("\n")
|
||||
task_tags = os.popen(f"task _get {task_id}.tags").read().split(",")
|
||||
if len(task_tags):
|
||||
task_tags = ":".join(task_tags).strip("\n") + ":"
|
||||
time = datetime.datetime.now().strftime("%y-%m-%d %H:%M")
|
||||
|
||||
with open(notes_file, "w") as f:
|
||||
f.write(f"%title: {task_description}")
|
||||
f.write(f":task:{task_project}:{task_tags if len(task_tags) else ''}\n")
|
||||
f.write(f"%date: {time}\n\n")
|
||||
f.flush()
|
||||
|
||||
os.execlp(EDITOR, EDITOR, notes_file)
|
||||
|
||||
|
||||
def update_task(task_id: int):
|
||||
os.popen(f"task {task_id} modify +note")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Write Taskwarrior notes")
|
||||
parser.add_argument('task_id', metavar='ID', type=int, help="ID of the task to note")
|
||||
args = parser.parse_args()
|
||||
|
||||
write_note(args.task_id)
|
||||
@@ -0,0 +1,8 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
|
||||
{
|
||||
home.file = {
|
||||
".taskrc".source = ./taskrc;
|
||||
".local/bin/task-note".source = ./bin/task-note.py;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
# [Created by task 2.5.3 9/25/2021 00:53:42]
|
||||
# Taskwarrior program configuration file.
|
||||
# For more documentation, see http://taskwarrior.org or try 'man task', 'man task-color',
|
||||
# 'man task-sync' or 'man taskrc'
|
||||
|
||||
# Here is an example of entries that use the default, override and blank values
|
||||
# variable=foo -- By specifying a value, this overrides the default
|
||||
# variable= -- By specifying no value, this means no default
|
||||
# #variable=foo -- By commenting out the line, or deleting it, this uses the default
|
||||
|
||||
# Use the command 'task show' to see all defaults and overrides
|
||||
|
||||
# Files
|
||||
data.location=~/.task
|
||||
#taskd.server=172.16.11.240:53589
|
||||
taskd.server=10.0.69.4:53589
|
||||
taskd.ca=~/.task/keys/ca.cert
|
||||
taskd.key=~/.task/keys/private.key
|
||||
taskd.certificate=~/.task/keys/public.cert
|
||||
taskd.trust=ignore hostname
|
||||
taskd.credentials=mossnet\/anish\/1647259c-e340-405c-a38b-11ac18e34688
|
||||
|
||||
report.next.filter=(status:pending -WAITING limit:0)
|
||||
# Color theme (uncomment one to use)
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/light-16.theme
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/light-256.theme
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/dark-16.theme
|
||||
#include /nix/store/nv663d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/dark-256.theme
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/dark-red-256.theme
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/dark-green-256.theme
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/dark-blue-256.theme
|
||||
include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/dark-violets-256.theme
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/dark-yellow-green.theme
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/dark-gray-256.theme
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/dark-gray-blue-256.theme
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/solarized-dark-256.theme
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/solarized-light-256.theme
|
||||
#include /nix/store/nv662d85k32kkpqidrj64qy1lnihac4c-taskwarrior-2.5.3/share/doc/task/rc/no-color.theme
|
||||
|
||||
uda.priority.values=H,M,,L
|
||||
news.version=2.6.0
|
||||
# uda.reviewed.type=date
|
||||
uda.reviewed.label=Reviewed
|
||||
report._reviewed.description=Tasksh review report. Adjust the filter to your needs.
|
||||
report._reviewed.columns=uuid
|
||||
report._reviewed.sort=reviewed+,modified+
|
||||
report._reviewed.filter=( reviewed.none: or reviewed.before:now-6days ) and ( +PENDING or +WAITING )
|
||||
report.list.columns=id,priority,project,tags,recur.indicator,scheduled.countdown,due,until.remaining,description.count
|
||||
report.list.labels=ID,P,Project,Tags,R,Sch,Due,Until,Description
|
||||
urgency.user.project.wait.coefficient=-10.0
|
||||
urgency.user.project.craft.coefficient=1.9
|
||||
urgency.user.project.chores.coefficient=0.8
|
||||
urgency.user.tag.think.coefficient=-7.0
|
||||
urgency.user.tag.purchase.coefficient=-1.2
|
||||
urgency.user.project.glam.coefficient=-1.3
|
||||
report.unblocked.labels=ID,Deps,Proj,Tags,Due,Active,Description
|
||||
report.unblocked.columns=id,depends,project,tags,due,start.active,description
|
||||
report.next.labels=ID,Active,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Urg
|
||||
report.next.columns=id,start.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency
|
||||
color.project.chores=blue
|
||||
color.tag.dev=cyan
|
||||
color.project.craft=green
|
||||
color.tag.purchase=rgb411
|
||||
color.tag.next=black on yellow
|
||||
color.sync.rejected=red
|
||||
color.blocked=color0
|
||||
color.blocking=red
|
||||
# color.tag.ops=rgb032
|
||||
color.project.none=rgb553
|
||||
color.footnote=yellow
|
||||
Reference in New Issue
Block a user