Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ignoring all uppercase tags with vtags #292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion taskwiki/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def tw_args_to_kwargs(args):
elif arg.startswith('+'):
value = arg[1:]
# Ignore virtual tags
if not value.isupper():
vtags = ["BLOCKED", "UNBLOCKED", "BLOCKING", "DUE", "DUETODAY", "TODAY", "OVERDUE", "WEEK", "MONTH", "QUARTER", "YEAR", "ACTIVE", "SCHEDULED", "PARENT", "CHILD", "UNTIL", "WAITING", "ANNOTATED", "READY", "YESTERDAY", "TOMORROW", "TAGGED", "PENDING", "COMPLETED", "DELETED", "UDA", "ORPHAN", "PRIORITY", "PROJECT", "LATEST"]
Copy link
Collaborator

@liskin liskin Jul 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to include a script (a comment is enough probably, doesn't need to actually be a separate file invoked automatically) to generate this list. E.g.

curl --silent --show-error --fail --location \
  https://github.com/GothenburgBitFactory/taskwarrior/raw/2.6.0/src/commands/CmdInfo.cpp \
| grep -P -o 'virtualTags \+= "\K\w+'
curl --silent --show-error --fail --location \
  https://github.com/GothenburgBitFactory/taskwarrior/raw/2.6.0/doc/man/task.1.in \
| awk '/^ +([A-Z]+) +Matches if the task/ { print $1 }'

Unfortunately the lists don't match as taskwarrior developers aren't very diligent in keeping them in sync despite all the comments reminding them to do so. :-(

I also think this might better go into constants.py, and should be accompanied by a test. :-)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In constants you can do something like:

TASKWARRIOR_VIRTUAL_TAGS = """
BLOCKED
UNBLOCKED
…
""".split()

to make it easier to paste the output of that command.

Regarding the test: not necessary to add a new test, augmenting an existing one should be good enough I think. :-)

if not value in vtags:
output.setdefault('tags', []).append(value)
# Ignore tag removal

Expand Down