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

Replace ignoring all uppercase tags with vtags #292

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 26, 2020

This commit explicitly defines a list of virtual tags as given in the
link given below at this point in time. This includes virtual tags
defined for version 2.6.0 (+QUARTER).

https://taskwarrior.org/docs/tags.html

This commit explicitly defines a list of virtual tags as given in the
link given below at this point in time. This includes virtual tags
defined for version 2.6.0 (+QUARTER).

https://taskwarrior.org/docs/tags.html
@@ -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. :-)

@tbabej tbabej force-pushed the master branch 9 times, most recently from b549521 to 36652d1 Compare September 18, 2020 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant