1
0
mirror of https://github.com/jbranchaud/til synced 2026-07-05 17:00:17 +00:00

Add Add Default Task To List All Tasks as a Taskfile TIL

This commit is contained in:
jbranchaud
2026-03-23 21:12:44 -05:00
parent 8af252f232
commit c875652725
2 changed files with 54 additions and 1 deletions
@@ -0,0 +1,52 @@
# Add Default Task To List All Tasks
One thing I like about [`just`](https://github.com/casey/just) is that if you
run `just` by itself, the default behavior is to list out all the commands it
can run.
[Taskfile](https://github.com/go-task/task) technically does this as well, but
with a warning at the end:
```
task
task: Available tasks for this project:
* notes: Interactive picker for notes tasks
* notes:diff: Show uncommitted changes in notes
* notes:edit: All-in-one edit, commit, and push notes
* notes:log: Show recent commit history for notes
* notes:open: Opens NOTES.md (syncs latest changes first) in default editor
* notes:push: Commit and push changes to notes submodule
* notes:status: Check status of notes submodule
* notes:sync: Sync latest changes from the notes submodule
task: Task "default" does not exist
```
I prefer to tidy this up a little by adding `task --list` as the _default_ in my
`Taskfile.yml`.
```yml
default:
desc: Show available commands
cmds:
- task --list
```
Now when I run `task` with no arguments, I get this minutely nicer version:
```
task
Alias tip: t
task: [default] task --list
task: Available tasks for this project:
* default: Show available commands
* notes: Interactive picker for notes tasks
* notes:diff: Show uncommitted changes in notes
* notes:edit: All-in-one edit, commit, and push notes
* notes:log: Show recent commit history for notes
* notes:open: Opens NOTES.md (syncs latest changes first) in default editor
* notes:push: Commit and push changes to notes submodule
* notes:status: Check status of notes submodule
* notes:sync: Sync latest changes from the notes submodule
```
Notice there is no `task: Task "default" does not exist` warning at the end.