timewarrior: Add hash and plus to taskwarrior tags

Add a hash sign in front of 'project' tags received from
taskwarrior (i.e. where it is `project:something` it will
end up as #something in timewarrior.

Similarly, add a plus sign in front of tags: `+mytag`.
Only descriptions will be left as-is in translating from
taskwarrior to timewarrior.

This should make finding tags and projects specifically
much easier in timewarrior (e.g. for counting up the total
time spent on a single project).
This commit is contained in:
Marty Oehme 2023-09-25 19:43:58 +02:00
parent 23793795d6
commit dfb9d7ff01
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -55,10 +55,10 @@ def extract_tags_from(json_obj):
tags = [json_obj['description']]
if 'project' in json_obj:
tags.append(json_obj['project'])
tags.append(f"#{json_obj['project']}")
if 'tags' in json_obj:
tags.extend(json_obj['tags'])
tags.extend([f"+{tag}" for tag in json_obj['tags']])
return tags