Skip to content

Commit

Permalink
Fix taskwarrior hook when tags are numeric values
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
bserem authored and lauft committed Mar 3, 2025
1 parent 234fbd1 commit 9205d77
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions on_modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ def extract_tags_from(json_obj):
# Usage of tasklib (e.g. in taskpirate) converts the tag list into a string
# If this is the case, convert it back into a list first
# See https://github.com/tbabej/taskpirate/issues/11
tags.extend(json_obj['tags'].split(','))
tag_list = json_obj['tags'].split(',')
else:
tags.extend(json_obj['tags'])
tag_list = json_obj['tags']

for i in range(len(tag_list['tags'])):
if tag_list['tags'][i].isnumeric():
tag_list['tags'][i] = '#' + tag_list['tags'][i]
tags.extend(tag_list['tags'])

return tags

Expand Down

0 comments on commit 9205d77

Please sign in to comment.