Skip to content

Commit 9205d77

Browse files
bseremlauft
authored andcommitted
Fix taskwarrior hook when tags are numeric values
When tags are numeric (ex: `3148`) the hook fails, because timewarrior treats it as a time value. The above change prepends `#` to all numeric tags, so that timewarrior will be triggered by taskwarrior correctly when using numeric only tags (for example: issue ids automatically fetched with bugwarrior).
1 parent 234fbd1 commit 9205d77

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

on_modify.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,14 @@ def extract_tags_from(json_obj):
5555
# Usage of tasklib (e.g. in taskpirate) converts the tag list into a string
5656
# If this is the case, convert it back into a list first
5757
# See https://github.com/tbabej/taskpirate/issues/11
58-
tags.extend(json_obj['tags'].split(','))
58+
tag_list = json_obj['tags'].split(',')
5959
else:
60-
tags.extend(json_obj['tags'])
60+
tag_list = json_obj['tags']
61+
62+
for i in range(len(tag_list['tags'])):
63+
if tag_list['tags'][i].isnumeric():
64+
tag_list['tags'][i] = '#' + tag_list['tags'][i]
65+
tags.extend(tag_list['tags'])
6166

6267
return tags
6368

0 commit comments

Comments
 (0)