timewarrior
timewarrior copied to clipboard
Ability to bulk modify intervals based on filter à la Taskwarrior's "modify"
Now that I've been using Timewarrior a while, I'm starting to better categorize items (mostly via changing the tags and possibly using annotations as well). I want to do various things like:
- for all intervals matching certain tags, add some other specific tags
- for all intervals with tags matching a certain pattern or regex, add some other specific tags
- rename a tag for all intervals having that tag
- remove a tag from all intervals having that tag
Currently I think I need to do a summary listing of the filter in question, extract all the IDs, and then construct a new command to add or remove tags for all IDs from the previous analysis. It would be GREAT if I could instead do this automatically based on a search, similar to how the modify
command works in Taskwarrior - Modify Command:
The same change, but to a set of tasks matching the filter:
$ task \( project:outdoors or /planting/ \) modify -home +garden
Correcting a spelling error in a task description:
$ task 1 modify /teh/the/
I realize Timewarrior currently has a modify command that unfortunately acts on one interval and the existence of which probably complicates this feature request.
for all intervals matching certain tags, add some other specific tags
The following will work with 1.4.0 (see #126):
$> timew tag $( timew get dom.tracked.id MATCH_TAG... ) ADDITIONAL_TAG...
for all intervals with tags matching a certain pattern or regex, add some other specific tags rename a tag for all intervals having that tag remove a tag from all intervals having that tag
Maybe see #179, where a redesign of tagging commands is proposed. As before this works by referencing the target interval via their id(s). Doing this with tags would require to work out where MATCHING_TAG...
ends in the command - this could prove tricky...
Thank you! I think I figured this out, but did that one not get documented, or was I looking in the wrong place?
I was finally coming to test this, and got an error upon running the suggested command (on v1.4.2):
$ timew get dom.tracked.id meeting
DOM reference 'dom.tracked.id' is not valid.
I went to the doc where I thought this should appear, but https://timewarrior.net/docs/timew-dom.7.html has nothing listed about IDs. I checked the commit log and found in https://github.com/GothenburgBitFactory/timewarrior/commit/c71eeb6dfd080ba09547a281a8bddd6bac0392d1 the actual string has an S, as in dom.tracked.ids
.
You are right, it should be dom.tracked.ids
- sorry for the typo. 😞
The documentation should be updated...
@lauft commented on Jun 29, 2020:
The following will work with 1.4.0 (see #126):
$> timew tag $( timew get dom.tracked.id MATCH_TAG... ) ADDITIONAL_TAG...
Could this some way be incorporated into the ext/on-modify.timewarrior
?
I am not sure about how to do deal with older versions of TimeWarrior, ie. whether it would be worth to branch the Py code on the version check.
EDIT: I guess the appropriate place could be this: https://github.com/GothenburgBitFactory/timewarrior/blob/8ba588dc24316a6977fa9c325b5220d02f088489/ext/on-modify.timewarrior#L93-L97