From b7af4da998c3e55d9e8e746893a3a49ed5cbbeb5 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sat, 11 Jul 2026 12:55:25 -0500 Subject: [PATCH] Add Initialize New Taskfile For A Project as a Taskfile TIL --- README.md | 3 +- .../initialize-new-taskfile-for-a-project.md | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 taskfile/initialize-new-taskfile-for-a-project.md diff --git a/README.md b/README.md index 7d34aae..59b74d5 100644 --- a/README.md +++ b/README.md @@ -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). -_1816 TILs and counting..._ +_1817 TILs and counting..._ See some of the other learning resources I work on: @@ -1626,6 +1626,7 @@ If you've learned something here, support my efforts writing daily TILs by - [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) +- [Initialize New Taskfile For A Project](taskfile/initialize-new-taskfile-for-a-project.md) - [Run A Task If It Meets Criteria](taskfile/run-a-task-if-it-meets-criteria.md) ### tmux diff --git a/taskfile/initialize-new-taskfile-for-a-project.md b/taskfile/initialize-new-taskfile-for-a-project.md new file mode 100644 index 0000000..a68700e --- /dev/null +++ b/taskfile/initialize-new-taskfile-for-a-project.md @@ -0,0 +1,39 @@ +# Initialize New Taskfile For A Project + +I'm adding [Taskfile](https://taskfile.dev/) to my [`py-vmt` +project](https://github.com/jbranchaud/py-vmt) to add clear, "documented with +code" ways of running the linter, formatter, type-checker, and tests. To get +started I need a `Taskfile.yml` file where I can define each of these tasks. +Instead of creating that file from scratch, the `task` utility has an `--init` +flag that will scaffold one for me. + +```bash +❯ task --init +Taskfile created: Taskfile.yml + +❯ cat Taskfile.yml +# https://taskfile.dev + +version: '3' + +vars: + GREETING: Hello, World! + +tasks: + default: + cmds: + - echo "{{.GREETING}}" + silent: true + +❯ task +Hello, World! +``` + +This is a useful starting point because it declares both a variable and a +default task. From there I can start defining the actual tasks I need for my +project. For that I will either reference the docs on [Adding a build +task](https://taskfile.dev/docs/getting-started#adding-a-build-task) or copy +some lines from either my [TIL +taskfile](https://github.com/jbranchaud/til/blob/master/Taskfile.yml) or +[dotfiles +taskfile](https://github.com/jbranchaud/dotfiles/blob/main/Taskfile.dist.yml).