Search code examples
bashscriptingshtaskwarrior

Taskwarrior: How to show just the most urgent task


I adore taskwarrior, it seems to be the only management app that you can dial in what you decide is the most urgent. Not just due today, or overdue, but a combination of values.

I want to put the top urgency task in a bunch of scripts and widgets (tmux, top bar etc), but this is the best I can do:

task next limit:1 | head -n 4 |tail -n1

Which displays the whole line, due dates, cruft and all, like this:

 1 2d  H Make widgets 16.5

I know about task _get, the DOM access, but I can't find the way to use it, or any filter.

How can I just display the description of the top task? Thanks!


Solution

  • You can use a one line script to get the ID of the latest, this is assuming that taskwarrior does not change its output format.

    task _get $(task next limit:1 | tail -n +4 | head -n 1 | sed 's/^ //' | cut -d ' ' -f1).description