Basic
Start with the basics of Taskfile.
How to get started with Taskfile
Create your Taskfile
There are multiple ways to create a Taskfile.
- Create a Taskfile in the current directory
- Create a Taskfile in a specific directory
- Create a Taskfile with a custom filename
- Manually create a Taskfile
Open the Taskfile in your favorite text editor.
The Taskfile will look like this:
- The task name is
default
. - You can define more tasks by adding them to the
task
section.
Here is a breakdown of the Taskfile:
Field | Description |
---|---|
version | The version of the Taskfile format to run |
vars | Variables that can be used in the Taskfile |
tasks | The tasks to run |
cmds | The commands to run |
silent | If true, The tasks metadata will not be printed, it will only print the output of the command. |
Add a new task to the Taskfile
Call a task
More Info
You can use task --help
to see all available options and flags.
When you run the task
command, it will **look for a Taskfile **in the current directory or in the specified directory.
In this case, we will run the hello
task that we just added to the Taskfile.
Verify the output by checking the contents of output.txt
:
You should see the following output: