Add boxed completion regex

Added recognition of `[x] my task done` to task logging.
This commit is contained in:
Marty Oehme 2021-10-31 16:46:28 +01:00
parent 46a07b1e48
commit 7fdf83f3fe
Signed by: Marty
GPG key ID: B7538B8F50A1C800
3 changed files with 6 additions and 6 deletions

View file

@ -5,7 +5,7 @@ It parses the `jrnl` file and logs accomplished tasks in `taskwarrior`.
To accomplish this it borrows a little from the [todo.txt](http://todotxt.org/) syntax --- To accomplish this it borrows a little from the [todo.txt](http://todotxt.org/) syntax ---
namely the idea of (A) (B) (C) prioritization and `x task done syntax` namely the idea of (A) (B) (C) prioritization and `x task done syntax`
(i.e. starting a line with `x ` means it represents an accomplished task). (i.e. starting a line with `x ` or `[x] ` means it represents an accomplished task).
## Usage ## Usage

View file

@ -45,9 +45,9 @@ def parse_file(options):
if not curdate: if not curdate:
continue continue
completed_task = re.search(r"^x ((?:\([A-D]\))? ?.*)$", line) completed_task = re.search(r"^(?:x|[x]) ((?:\([A-D]\))? ?.*)$", line)
if completed_task and options.taskwarrior_log_done: if completed_task and options.taskwarrior_log_completed:
log_done_to_taskwarrior(completed_task[1], curdate, options.dryrun) log_completed_to_taskwarrior(completed_task[1], curdate, options.dryrun)
lines_to_delete.append(line_number) lines_to_delete.append(line_number)
if lines_to_delete: if lines_to_delete:
@ -68,7 +68,7 @@ def get_prio_string(task_string):
return prio_string return prio_string
def log_done_to_taskwarrior(task_string, date, dryrun): def log_completed_to_taskwarrior(task_string, date, dryrun):
overrides = ["rc.context=none", "rc.verbose=nothing", "rc.hooks=0"] overrides = ["rc.context=none", "rc.verbose=nothing", "rc.hooks=0"]
cmd = [ cmd = [

View file

@ -8,7 +8,7 @@ class Options:
jrnl_fname: str = f"{os.path.expanduser('~')}/documents/records/todo.md" jrnl_fname: str = f"{os.path.expanduser('~')}/documents/records/todo.md"
todo_block_title: str = "todotxt" todo_block_title: str = "todotxt"
dryrun: bool = False dryrun: bool = False
taskwarrior_log_done: bool = True taskwarrior_log_completed: bool = True
def init(): def init():