I’ve made some changes to na that make it a very handy tool for general querying of a TaskPaper file. Now you can quickly find actions based on project, tag, or text content right from the command line.
na has subcommands for searching text (
na find) and for matching tags (
na tagged). As your todo file grows, these are handy for narrowing down what you need to work on at any given time. I believe I’ve improved their usefulness in the last couple releases. Just run
gem install na to install or upgrade.
taggedcommands no longer require the next action tag (@na) to be present to match. You can still query just next actions by adding
taggedcommand. But by default all matching actions will be shown with
tagged, not just next actions.
You can now use
!to require that a tag or search term not exist on matched actions, e.g.
na tagged "priority=3, !maybe".
You can now use wildcards (* or ?) in text and tag searches. You can also use the
--regexflag with the
findcommand to interpret the search as a regular expression. Invert any search results with
-v/--invertto display all actions not matching the search.
You can perform value comparisons with more operators on tag values now, too. When using the
taggedcommand, specify your tag searches as tokens containing
=to perform a numeric comparison (e.g.
na tagged "priority>=3, +maybe"). You can do string searches with
^=(starts with), and
$=(ends with), e.g.
na tagged "+na, +note*=video". These can be combined with wildcard matching, e.g.
na tagged "note*=m*down".
You can also query specific projects with
--project PROJECT. The project can be a simple string or a path separated with
:to match subprojects, e.g.
na next --project marked/bugs. The project matching accepts partial matches, so that example could be
na next --project mark/bug. If there’s only one
Bugs:project in the current directory (or subdirectories if using
--depth), you don’t need to specify a path,
na next --project bugswill find it. The
--projectflag (which can be shortened as
--proj) works with
tagged. This can be especially handy if the directory contains multiple TaskPaper files as a quick means of targeting just one project.
One other thing recently added is the ability to add actions to a specific project rather than just “Inbox:”. Just use
na add --to PROJECT to add to the named project (case insensitive). If the project isn’t found in the selected target file, it will be created at the top.
Hopefully all of this broadens the usefulness of
na. Let me know if you have any feature requests!