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

Adds +VISIBLE metatag #307

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nkakouros
Copy link
Contributor

Adds a +VISIBLE metatag to display tasks already displayed in the file. This is useful to have different or aggregate sortings of tasks. For instance, you can have 2 projects that track your work under two different viewports. These 2 projects are equally important. On the top of the file, you just use a <name> | +VISIBLE viewport and you get all the tasks from both projects ordered by priority, so that you know which one you should work on first.

Copy link
Collaborator

@liskin liskin left a comment

Choose a reason for hiding this comment

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

Just had a quick look and added a couple comments/suggestions...

@@ -171,6 +171,8 @@ def get_complement_tag(tag):
for token in taskfilter_args:
if token == '-VISIBLE':
meta['visible'] = False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
meta['visible'] = False
if token == '-VISIBLE' or token == '+VISIBLE':
meta['visible'] = token[0] == '+'

return set(
task for task in self.tw.tasks.filter(*args)
if task in tasks_outside_viewport
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

            return set(
                task for task in self.tw.tasks.filter(*args)
                if (task in tasks_outside_viewport) == self.meta['visible']
            )

class TestViewportsVisibleMetaTag(MultiSyntaxIntegrationTest):

viminput = """
HEADER2(Home tasks | project:Home +VISIBLE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Drop the project:Home, as otherwise this isn't testing the +VISIBLE meta tag at all, the chore task would be there anyway.

Matching taskwarrior tasks: 0
Displayed tasks: 1
Tasks to be added:
Tasks to be deleted: tag work task
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this intended?

I'd appreciate a comment explaining what this test really tests, as I don't think it's obvious. :-/

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.

2 participants