Taskwarrior: Filtering for non-blank values

Created on 10 May 2020  ·  5Comments  ·  Source: GothenburgBitFactory/taskwarrior

How can I filter for tasks that have any value for a specific attribute, such as project?
I know I can search for tasks with no project simply with project: and for tasks that don't have a specific project with "project != something", but how can I find all tasks that have a project? I don't think there is even a not operator, and whether regex works in attribute filters is still a mystery to me...

The documentation for filters definitely needs some love.

Most helpful comment

task <report> project.not: returns all the projects without any projects defined.

I have found that I can use <thing>.not:<value> as a way to say thing != value. Sadly, I do not remember where I picked up this bit of syntax over the years.

Hope that helps!

All 5 comments

task <report> project.not: returns all the projects without any projects defined.

I have found that I can use <thing>.not:<value> as a way to say thing != value. Sadly, I do not remember where I picked up this bit of syntax over the years.

Hope that helps!

@duckunix
Thanks for the tip, I agree this suppose to be mentioned in https://taskwarrior.org/docs/filter.html.
Also, it needs examples of regex.

Hey, why close this? Doesn't seem like the documentation is adjusted.

The man page actually has a section called Attribute Modifiers. It is even linked from the Filter section.

ATTRIBUTE MODIFIERS
       Attribute modifiers improve filters.  Supported modifiers are:

              before (synonyms under, below)
              after (synonyms over, above)
              none
              any
              is (synonym equals)
              isnt (synonym not)
              has (synonym contains)
              hasnt
              startswith (synonym left)
              endswith (synonym right)
              word
              noword

<...>
       <...>
       as  a convenient shortcut.  The 'contains' here is an attribute modifier, which is used to exert
       more control over the filter than simply absence or presence.  See the section 'ATTRIBUTE  MODI‐
       FIERS' below for a complete list of modifiers.

oh nice. Yeah I think the issue is that man page and website aren't aligned that well.

Was this page helpful?
0 / 5 - 0 ratings