Taskwarrior: How to show just the most urgent task

1k Views Asked by At

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!

4

There are 4 best solutions below

1
On BEST ANSWER

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
0
On

Awk would also work:

$ task _get $(task next limit:1 | awk 'NR==4{print $1}').description
0
On

Make a new report named 'desrc' by adding the following lines to your .taskrc file:

report.desrc.columns = description
report.desrc.labels  = Description
report.desrc.sort    = urgency-

and then ask for the desrc list:

task rc.verbose: limit:1 desrc

The rc.verbose: removes headlines and everything else, so no need for head and tail.

0
On

You could sure use cut to get only certain elements of that line, separated by tabs. It's a fast coreutil. Nothing against creating a new report though, just wanted to mention it.