1
0
mirror of https://github.com/jbranchaud/til synced 2026-07-03 16:18:24 +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
+2 -1
View File
@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
_1764 TILs and counting..._
_1765 TILs and counting..._
See some of the other learning resources I work on:
@@ -1578,6 +1578,7 @@ If you've learned something here, support my efforts writing daily TILs by
### Taskfile
- [Add Default Task To List All Tasks](taskfile/add-default-task-to-list-all-tasks.md)
- [Create Interactive Picker For Set Of Subtasks](taskfile/create-interactive-picker-for-set-of-subtasks.md)
- [Run A Task If It Meets Criteria](taskfile/run-a-task-if-it-meets-criteria.md)
@@ -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.