Skip to content

Pipeline examples

Casey Miller edited this page Jul 22, 2026 · 2 revisions

Examples with Pipelines

Pipeline support is builtin so you can filter, sort, group, and reshape your todos with the same commands you already use everywhere else.

Filtering

> todu | where status == pending

> todu | where priority? == high

> todu | where priority? > medium

> todu --overdue

Note the ? after priority and tag — those fields are only present on rows that actually have a priority or tag set, so priority?/tag? require an optional-cell-path lookup.

Sorting and grouping

> todu | sort-by priority? -r
╭───┬────┬───────────────────────┬─────────┬──────────┬───────────┬──────╮
 # │ id │         title         │ status  │ priority │    due    │ tag  │
├───┼────┼───────────────────────┼─────────┼──────────┼───────────┼──────┤
 0   1  fix login bug...       pending  high      in a day   bug  
 1   2  write onboarding docs  pending  medium    in 2 days  docs 
 2   4  refactor auth module   pending  low                auth 
 3   3  write changelog        pending                   docs 
╰───┴────┴───────────────────────┴─────────┴──────────┴───────────┴──────╯

> todu | group-by tag
╭──────┬────────────────╮
 bug   [table 1 row]  
 docs  [table 2 rows] 
 auth  [table 1 row]  
╰──────┴────────────────╯

Bulk status changes

todu done/start/stop/pause/reopen and todu clear all accept a piped list of ids, so you can select a batch of todos with where and act on all of them in one shot:

# finish every docs-tagged task at once
> todu | where tag? == docs | get id | todu done

# archive every bug that's done
> todu --all | where tag? == bug | where status == done | get id | todu clear

Bulk metadata edits

# tag a single task
> todu tag work 1

# set the same priority on several tasks at once, ids given directly
> todu priority high 2 3

# re-tag every task currently marked "docs" as "blocked"
> todu | where tag? == docs | get id | todu tag blocked

# push every "ops" task out to next friday
> todu | where tag? == ops | get id | todu due next-friday

Chaining add to create subtasks

todu add returns the row it just created, so you can use $in later in the pipeline.

> todu add "ship v2 release" | todu add $"write tests ^($in.id)"

# add multiple subtasks at once the same way
> todu add "ship v3 release" | todu add $"write tests ^($in.id)" $"update docs ^($in.id)"

> todu get 1
╭──────────┬─────────────────╮
 id        1               
 title     ship v2 release 
 status    pending         
 subtasks  [table 1 row]   
 source    local           
 created   now             
╰──────────┴─────────────────╯

Ad-hoc reporting

Since todu output is just a table, anything nushell can do to a table works here too:

# how many todos are still pending?
> todu --all | where status == pending | length

# count of open todos per tag
> todu | group-by tag | transpose tag todos | insert count {|row| $row.todos | length }

Clone this wiki locally