### Define a Taskfile structure Source: https://taskfile.dev/docs/getting-started Example of a standard Taskfile.yml configuration. It demonstrates the use of versioning, global variables, and task definitions with silent execution. ```yaml version: '3' vars: GREETING: Hello, World! tasks: default: desc: Print a greeting message cmds: - echo "{{.GREETING}}" silent: true build: cmds: - go build ./cmd/main.go ``` -------------------------------- ### Install Task using GitHub Actions Source: https://taskfile.dev/installation Installs Task within GitHub Actions workflows using the official `go-task/setup-task` action. Check the repository for more examples. ```yaml - name: Install Task uses: go-task/setup-task@v1 ``` -------------------------------- ### Install Task with apt Source: https://taskfile.dev/installation Use this command to install Task after setting up the apt repository. ```shell curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.deb.sh' | sudo -E bash ``` ```shell apt install task ``` -------------------------------- ### Build Task from Source (Latest Release) Source: https://taskfile.dev/installation Installs the latest release of Task globally using `go install`. Ensure a supported Go version is installed and set up. ```shell go install github.com/go-task/task/v3/cmd/task@latest ``` -------------------------------- ### Execute tasks via CLI Source: https://taskfile.dev/docs/getting-started Commands to run tasks defined in a Taskfile. Includes running default tasks, specifying directories, and targeting custom filenames. ```shell task default task --dir ./subdirectory task --taskfile Custom.yml task build ``` -------------------------------- ### Complete Example Taskfile Configuration Source: https://taskfile.dev/llms-full.txt A comprehensive example of a `.taskrc.yml` file demonstrating all available global settings and experimental features. ```yaml # Global settings verbose: true silent: false color: true disable-fuzzy: false concurrency: 2 # Enable experimental features experiments: REMOTE_TASKFILES: 1 ``` -------------------------------- ### Install Task with Mise (ubi backend) Source: https://taskfile.dev/docs/installation Use Mise with the ubi backend to install go-task. This method installs directly from GitHub releases. ```shell mise use -g ubi:go-task/task mise install ``` -------------------------------- ### Install Task with apk Source: https://taskfile.dev/installation Use this command to install Task after setting up the apk repository. ```shell curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.alpine.sh' | sudo -E bash ``` ```shell apk add task ``` -------------------------------- ### Install Task using Homebrew (Official Tap) Source: https://taskfile.dev/docs/installation Installs Task using Homebrew from the official go-task/homebrew-tap repository. This is the recommended Homebrew installation method. ```shell brew install go-task/tap/go-task ``` -------------------------------- ### Example Taskfile Configuration with Experiments Source: https://taskfile.dev/llms-full.txt This example shows how to enable experimental features in Task configuration. Ensure you refer to the experiments documentation for available feature names and their values. ```yaml experiments: feature_name: 1 another_feature: 2 ``` -------------------------------- ### Install Task with Directory and Version Source: https://taskfile.dev/installation Sets both the installation directory and a specific version of Task. Parameters are order-specific. ```shell sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin v3.42.1 ``` -------------------------------- ### Initialize Taskfile via CLI Source: https://taskfile.dev/docs/getting-started Commands to generate a new Taskfile. Users can initialize in the current directory, a specific subdirectory, or with a custom filename. ```shell task --init task --init ./subdirectory task --init Custom.yml ``` -------------------------------- ### Task Summary Output Example Source: https://taskfile.dev/docs/guide Example output when running `task --summary release`, showing the task's summary, dependencies, and commands. ```shell task: release Release your project to github It will build your project before starting the release. Please make sure that you have set GITHUB_TOKEN before starting. dependencies: - build commands: - your-release-tool ``` -------------------------------- ### Install Task with dnf Source: https://taskfile.dev/installation Use this command to install Task after setting up the dnf repository. ```shell curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.rpm.sh' | sudo -E bash ``` ```shell dnf install task ``` -------------------------------- ### Set and Shopt Options Example Source: https://taskfile.dev/usage Demonstrates how to specify options for the `set` and `shopt` shell builtins at the global level. These options affect how commands are executed. ```yaml version: '3' set: [pipefail] shopt: [globstar] tasks: # `globstar` required for double star globs to work default: echo **/*.go ``` -------------------------------- ### Install Task with pip Source: https://taskfile.dev/installation Install Task using pip, offering a cross-platform installation method similar to npm. ```shell pip install go-task-bin ``` -------------------------------- ### Build Task from Source (Custom Directory) Source: https://taskfile.dev/installation Installs Task into a specified directory using `go install` with the `GOBIN` environment variable. Recommended for specific project needs. ```shell env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest ``` -------------------------------- ### Install Task with Mise (aqua/ubi) Source: https://taskfile.dev/installation Install Task using Mise with either the aqua or ubi backends, which install directly from GitHub releases. ```shell mise use -g aqua:go-task/task@latest mise install ``` ```shell mise use -g ubi:go-task/task mise install ``` -------------------------------- ### Install Task with Homebrew Source: https://taskfile.dev/installation Install Task using the official Homebrew tap or the default Homebrew repository. ```shell brew install go-task/tap/go-task ``` ```shell brew install go-task ``` -------------------------------- ### Install Task with Snap Source: https://taskfile.dev/installation Install Task using Snapcraft. Ensure your Linux distribution allows classic confinement for Task to work correctly. ```shell sudo snap install task --classic ``` -------------------------------- ### Install Task with Mise (aqua backend) Source: https://taskfile.dev/docs/installation Use Mise with the aqua backend to install the latest version of go-task. Ensure Mise is installed and configured. ```shell mise use -g aqua:go-task/task@latest mise install ``` -------------------------------- ### Install Task with WinGet Source: https://taskfile.dev/installation Install Task via the community repository using WinGet. ```shell winget install Task.Task ``` -------------------------------- ### Install Task with Nix Source: https://taskfile.dev/installation Install Task using the Nix package manager. ```shell nix-env -iA nixpkgs.go-task ``` -------------------------------- ### Install Task with FreeBSD (Ports) Source: https://taskfile.dev/installation Install Task using the Ports collection on FreeBSD. ```shell pkg install task ``` -------------------------------- ### Install Task to Custom Directory Source: https://taskfile.dev/installation Installs Task to a specified directory using the `-b` parameter. Common choices include `~/.local/bin` or `~/bin` for user-specific installs, or `/usr/local/bin` for system-wide installs. ```shell sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin ``` -------------------------------- ### Global Taskfile Examples Source: https://taskfile.dev/usage Demonstrates running tasks from the home directory using the `--global` flag and from the user's working directory using the `dir` attribute with `{{.USER_WORKING_DIR}}`. ```yaml version: '3' tasks: from-home: cmds: - pwd from-working-directory: dir: '{{.USER_WORKING_DIR}}' cmds: - pwd ``` -------------------------------- ### Install Task using Homebrew (Core Repository) Source: https://taskfile.dev/docs/installation Installs Task using Homebrew from the official Homebrew core repository. This may not be as up-to-date as the official tap. ```shell brew install go-task ``` -------------------------------- ### Install Task with npm Source: https://taskfile.dev/installation Install Task globally or as a project dependency using npm. This provides a cross-platform installation method. ```shell npm install -g @go-task/cli ``` -------------------------------- ### Global Taskfile Example Source: https://taskfile.dev/docs/guide Demonstrates tasks that run from the home directory and from the user's working directory when using the --global flag. ```yaml version: '3' tasks: from-home: cmds: - pwd from-working-directory: dir: '{{.USER_WORKING_DIR}}' cmds: - pwd ``` -------------------------------- ### Install Task with pacstall Source: https://taskfile.dev/installation Install Task using the pacstall package manager. ```shell pacstall -I go-task-deb ``` -------------------------------- ### Install Task with pkgx Source: https://taskfile.dev/docs/installation Install Task using pkgx, a cross-platform package manager for Linux and macOS. This command installs Task and makes it available in your PATH. ```shell pkgx task ``` -------------------------------- ### Install Task with Scoop Source: https://taskfile.dev/installation Install Task using the Scoop package manager. ```shell scoop install task ``` -------------------------------- ### Install Task with Default Directory Source: https://taskfile.dev/installation Installs Task to the `./bin` directory relative to the working directory. Useful for CI environments. ```shell sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d ``` -------------------------------- ### Short Task Syntax Example Source: https://taskfile.dev/usage Illustrates the shorter syntax for defining tasks when they use default settings. This reduces boilerplate for simple tasks. ```yaml version: '3' tasks: build: go build -v -o ./app{{exeExt}} . run: - task: build - ./app{{exeExt}} -h localhost -p 8080 ``` -------------------------------- ### Global Taskfile examples Source: https://taskfile.dev/llms-full.txt Demonstrates running tasks from the global Taskfile. The 'from-home' task runs in the home directory, while 'from-working-directory' uses 'dir' to run in the current working directory. ```yaml version: '3' tasks: from-home: cmds: - pwd from-working-directory: dir: '{{.USER_WORKING_DIR}}' cmds: - pwd ``` -------------------------------- ### Install Task with Fedora (dnf) Source: https://taskfile.dev/installation Install Task using the dnf package manager on Fedora. ```shell dnf install go-task ``` -------------------------------- ### Install Task with pkgx Source: https://taskfile.dev/installation Install Task using the pkgx package manager. If pkgx integration is enabled, you can simply run 'task'. ```shell pkgx task ``` ```shell task ``` -------------------------------- ### Prefixed Output Execution Example Source: https://taskfile.dev/usage Demonstrates the execution of tasks using 'prefixed' output, showing how each line is prefixed with the task name and custom prefixes defined for commands. ```shell $ task default [print-foo] foo [print-bar] bar [print-baz] baz ``` -------------------------------- ### Example Configuration File Precedence Source: https://taskfile.dev/llms-full.txt Illustrates how Task merges configuration from multiple files, with the project-specific file having the highest priority and the global config the lowest. ```yaml # lowest priority global config option_1: foo option_2: foo option_3: foo ``` ```yaml option_1: bar option_2: bar ``` ```yaml # highest priority project config option_1: baz ``` ```yaml option_1: baz # Taken from $HOME/path/to/project/.taskrc.yml option_2: bar # Taken from $HOME/.taskrc.yml option_3: foo # Taken from $XDG_CONFIG_HOME/task/.taskrc.yml ``` -------------------------------- ### Install Task with Chocolatey Source: https://taskfile.dev/installation Install Task using the Chocolatey package manager. ```shell choco install go-task ``` -------------------------------- ### Install Task with Macports Source: https://taskfile.dev/installation Install Task using the Macports package manager. ```shell port install go-task ``` -------------------------------- ### Grouped Output Example Execution Source: https://taskfile.dev/usage Demonstrates the execution of a task with 'group' output, showing the begin and end group markers and the command's output. ```shell $ task default ::group::default Hello, World! ::endgroup:: ``` -------------------------------- ### Remote Taskfile Examples Source: https://taskfile.dev/llms-full.txt Examples of different node types for referencing remote Taskfiles via HTTP/HTTPS or Git. These are experimental features. ```text https://raw.githubusercontent.com/go-task/task/main/website/src/public/Taskfile.yml ``` ```text https://github.com/go-task/task.git//website/src/public/Taskfile.yml?ref=main ``` ```text git@github.com:go-task/task.git//website/src/public/Taskfile.yml?ref=main ``` -------------------------------- ### Install Task with Arch (pacman) Source: https://taskfile.dev/installation Install Task using the pacman package manager on Arch Linux. ```shell pacman -S go-task ``` -------------------------------- ### Group Output Example with GitHub Actions Commands Source: https://taskfile.dev/llms-full.txt Demonstrates the 'group' output mode with custom begin and end messages, simulating GitHub Actions log grouping. ```shell $ task default ::group::default Hello, World! ::endgroup:: ``` -------------------------------- ### Display Task List Output Source: https://taskfile.dev/docs/guide Example output of the `task --list` command, showing tasks and their descriptions. ```shell * build: Build the go binary. * test: Run all the go tests. ``` -------------------------------- ### Task Full Example Configuration (YAML) Source: https://taskfile.dev/docs/reference/config A complete example of a `.taskrc.yml` file demonstrating all available configuration options, including global settings and experimental features. ```yaml # Global settings verbose: true silent: false color: true disable-fuzzy: false concurrency: 2 # Enable experimental features experiments: REMOTE_TASKFILES: 1 ``` -------------------------------- ### Define Task with Sources and Generates Source: https://taskfile.dev/usage This example shows how to define sources and generated files for a task. Task will compare the checksum of source files to determine if the task needs to run. ```yaml version: '3' tasks: build: deps: [js, css] cmds: - go build -v -i main.go js: cmds: - esbuild --bundle --minify js/index.js > public/bundle.js sources: - src/js/**/*.js generates: - public/bundle.js css: cmds: - esbuild --bundle --minify css/index.css > public/bundle.css sources: - src/css/**/*.css generates: - public/bundle.css ``` -------------------------------- ### Show Task Version Source: https://taskfile.dev/llms-full.txt Display the installed version of Task. ```bash task --version ``` -------------------------------- ### Example Remote Taskfile (YAML) Source: https://taskfile.dev/experiments/remote-taskfiles A sample Taskfile stored remotely, demonstrating basic task definitions for testing the remote Taskfiles feature. ```yaml version: '3' tasks: default: cmds: - task: hello hello: cmds: - echo "Hello Task!" ``` -------------------------------- ### Setup Zsh Completions Source: https://taskfile.dev/installation Loads Task shell completions for Zsh by evaluating the output of `task --completion zsh` in your `~/.zshrc`. Set `TASK_EXE` if your executable is named differently. ```shell # ~/.zshrc # export TASK_EXE='go-task' if needed eval "$(task --completion zsh)" ``` -------------------------------- ### Call Task with Multiple Wildcard Arguments Source: https://taskfile.dev/docs/guide This example shows how to invoke a task that uses multiple wildcards, passing arguments that are then used to set SERVICE and REPLICAS variables. ```shell $ task start:foo:3 Starting foo with 3 replicas ``` -------------------------------- ### Shell Example for Approved Prompt Source: https://taskfile.dev/llms-full.txt Shows the output when a user confirms a warning prompt by entering 'y'. ```shell ❯ task example not dangerous command task: "This is a dangerous command. Do you want to continue?" [y/N] y dangerous command another not dangerous command ``` -------------------------------- ### Interactive Prompt Example Source: https://taskfile.dev/docs/guide Demonstrates the interactive prompt for selecting an enum value and entering a text value for missing variables. ```shell $ task deploy ? Select value for ENVIRONMENT: ❯ dev staging prod ? Enter value for VERSION: 1.0.0 Deploying 1.0.0 to prod ``` -------------------------------- ### Run Task with pkgx integration Source: https://taskfile.dev/docs/installation If pkgx integration is enabled, you can run Task directly using the 'task' command after installation via pkgx. ```shell task ``` -------------------------------- ### Task Configuration File Precedence Example (YAML) Source: https://taskfile.dev/docs/reference/config Illustrates how Task merges configuration from multiple files based on precedence, starting from the lowest priority in `$XDG_CONFIG_HOME/task` to the highest in the project directory. This example uses YAML format. ```yaml # lowest priority global config option_1: foo option_2: foo option_3: foo ``` ```yaml option_1: bar option_2: bar ``` ```yaml # highest priority project config option_1: baz ``` ```yaml option_1: baz # Taken from $HOME/path/to/project/.taskrc.yml option_2: bar # Taken from $HOME/.taskrc.yml option_3: foo # Taken from $XDG_CONFIG_HOME/task/.taskrc.yml ``` -------------------------------- ### Shell Example for Warning Prompt Source: https://taskfile.dev/llms-full.txt Demonstrates the interactive prompt when a task with a 'prompt' field is executed without the --yes flag. ```shell ❯ task dangerous task: "This is a dangerous command... Do you want to continue?" [y/N] ``` -------------------------------- ### Prefixed Output Example with Custom Prefixes Source: https://taskfile.dev/llms-full.txt Demonstrates the 'prefixed' output mode where each command's output is prefixed. The 'print' task uses a custom prefix based on its variables. ```shell $ task default [print-foo] foo [print-bar] bar [print-baz] baz ``` -------------------------------- ### Example of dependency loop output variation Source: https://taskfile.dev/usage Demonstrates that when looping over dependencies, the order of execution is not guaranteed due to parallel processing, potentially leading to different output orders. ```shell foo bar ``` ```shell bar foo ``` -------------------------------- ### Dynamically Generate Enum Values from Shell Command Source: https://taskfile.dev/docs/guide Generate enum values dynamically from a shell command's output. This example uses `ls` to get a list of services and `splitLines` to create an enum list. ```yaml version: '3' vars: AVAILABLE_SERVICES: sh: ls services/ tasks: deploy: requires: vars: - name: SERVICE enum: ref: .AVAILABLE_SERVICES | splitLines | compact cmds: - echo "Deploying {{.SERVICE}}" ``` -------------------------------- ### Example Taskfile Configuration for Verbose Output Source: https://taskfile.dev/llms-full.txt Enable verbose output for all tasks by setting the 'verbose' option to true. This can also be controlled via CLI flags or environment variables. ```yaml verbose: true ``` -------------------------------- ### Specify Minimum Taskfile Version (YAML) Source: https://taskfile.dev/docs/taskfile-versions This example demonstrates how to specify the minimum required Task CLI version for a Taskfile. It ensures that users running the Taskfile have a compatible version of Task installed, preventing errors due to missing features. The version format follows SemVer. ```yaml version: '3.2.1' ``` -------------------------------- ### Install Shell Completions for Task Source: https://taskfile.dev/llms-full.txt Copy the script to your shell's completions directory to enable shell autocompletion for Task. This method requires manual updates when Task is updated. ```shell task --completion bash > /etc/bash_completion.d/task ``` ```shell task --completion zsh > /usr/local/share/zsh/site-functions/_task ``` ```shell task --completion fish > ~/.config/fish/completions/task.fish ``` -------------------------------- ### Setup PowerShell Completions Source: https://taskfile.dev/installation Loads Task shell completions for PowerShell by invoking the output of `task --completion powershell` in your `$PROFILE\Microsoft.PowerShell_profile.ps1`. Set `TASK_EXE` if your executable is named differently. ```powershell # $PROFILE\Microsoft.PowerShell_profile.ps1 Invoke-Expression (&task --completion powershell | Out-String) ``` -------------------------------- ### Setup Fish Completions Source: https://taskfile.dev/installation Loads Task shell completions for Fish by piping the output of `task --completion fish` to `source` in your `~/.config/fish/config.fish`. Set `TASK_EXE` if your executable is named differently. ```shell # ~/.config/fish/config.fish # export TASK_EXE='go-task' if needed task --completion fish | source ``` -------------------------------- ### Initialize Taskfile Source: https://taskfile.dev/llms-full.txt Create a new Taskfile.yml in the current directory. Use '-i' as a shorthand. ```bash task --init ``` ```bash task -i ``` -------------------------------- ### Show Help Information Source: https://taskfile.dev/llms-full.txt Display help information for Task commands. Use '-h' or '--help'. ```bash task --help ``` -------------------------------- ### Import Taskfile Package Source: https://taskfile.dev/reference/package Import the necessary taskfile package to begin reading Taskfiles. ```go import ( "github.com/go-task/task/v3/taskfile" ) ``` -------------------------------- ### Package API - Initialization Source: https://taskfile.dev/docs/changelog Details on the `task.InitTaskfile` function, including changes to its arguments and return values. ```APIDOC ## Package API - `task.InitTaskfile` ### Description Initializes a Taskfile. This function has undergone changes regarding its output handling and argument parsing. ### Method N/A (Function within a package) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Changes in v3.42.0: - No longer accepts an `io.Writer` (output is now the caller's responsibility). - The path argument can now be a filename OR a directory. - The function now returns the full path of the generated file. ``` -------------------------------- ### Install Specific Task Version Source: https://taskfile.dev/installation Installs a specific version of Task by providing a release tag. This ensures consistent behavior across environments. ```shell sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d v3.36.0 ``` -------------------------------- ### List All Tasks Source: https://taskfile.dev/llms-full.txt Display all available tasks along with their descriptions. Use '-l' as a shorthand. ```bash task --list ``` ```bash task -l ``` -------------------------------- ### GitHub Actions Error Annotation Example Source: https://taskfile.dev/usage Example of an error annotation emitted by Task when running in GitHub Actions, highlighting a task failure in the workflow summary. ```shell ::error title=Task 'build' failed::exit status 1 ``` -------------------------------- ### Setup Bash Completions Source: https://taskfile.dev/installation Loads Task shell completions for Bash by evaluating the output of `task --completion bash` in your `~/.bashrc`. Set `TASK_EXE` if your executable is named differently. ```shell # ~/.bashrc # export TASK_EXE='go-task' if needed eval "$(task --completion bash)" ``` -------------------------------- ### Short Task Syntax for Simple Tasks Source: https://taskfile.dev/docs/guide Use a concise syntax for tasks with default settings. This example shows a 'build' task defined directly with a command and a 'run' task that depends on 'build'. ```yaml version: '3' tasks: build: go build -v -o ./app{{exeExt}} . run: - task: build - ./app{{exeExt}} -h localhost -p 8080 ``` -------------------------------- ### Shell Example for Silent Mode Source: https://taskfile.dev/llms-full.txt Compares the output of a command when silent mode is off versus when it is on. ```shell echo "Print something" Print something ``` ```shell Print something ``` -------------------------------- ### Read and Merge Taskfiles in Go Source: https://taskfile.dev/docs/reference/package Demonstrates the complete workflow for reading a Taskfile from the filesystem using a FileNode, creating a reader, parsing the graph, and merging it into a final Taskfile structure. ```go import ( "context" "log/slog" "github.com/go-task/task/v3/taskfile" ) // Initialize the file node node := taskfile.NewFileNode("Taskfile.yml", "./path/to/dir") // Create a reader with optional debug function reader := taskfile.NewReader( taskfile.WithDebugFunc(func(s string) { slog.Debug(s) }), ) // Read the taskfile into a graph ctx := context.Background() tfg, err := reader.Read(ctx, node) if err != nil { // handle error } // Merge the graph into a single Taskfile tf, err := tfg.Merge() if err != nil { // handle error } ``` -------------------------------- ### External Script for Task Command Source: https://taskfile.dev/llms-full.txt An example of a bash script that can be called from a Taskfile for executing multi-line logic. ```shell #!/bin/bash a=foo echo $a ``` -------------------------------- ### Create a File Node Source: https://taskfile.dev/reference/package Create a file node representing the Taskfile to be read. Specify the filename and its directory path. ```go node := taskfile.NewFileNode("Taskfile.yml", "./path/to/dir") ``` -------------------------------- ### List All Tasks (Including UnsetDescription) Source: https://taskfile.dev/llms-full.txt Show all tasks, even those without descriptions. Use '-a' as a shorthand. ```bash task --list-all ``` ```bash task -a ``` -------------------------------- ### Get Length of Collections with len Source: https://taskfile.dev/llms-full.txt Use the 'len' function to determine the number of items in arrays, maps, or characters in strings. ```yaml tasks: length: vars: ITEMS: [a, b, c, d] TEXT: "Hello World" cmds: - echo "Found {{len .ITEMS}} items" - echo "Text has {{len .TEXT}} characters" ``` -------------------------------- ### Extract Array/String Portions with slice Source: https://taskfile.dev/llms-full.txt Use the 'slice' function to extract a sub-section of an array or string by specifying start and end indices. ```yaml tasks: slice-demo: vars: ITEMS: [a, b, c, d, e] cmds: - echo "{{slice .ITEMS 1 3}}" # [b c] ``` -------------------------------- ### Initialize a Taskfile Source: https://taskfile.dev/getting-started Creates a new Taskfile.yml in the current directory. You can specify a different directory or filename. ```shell task --init ``` ```shell task --init ./subdirectory ``` ```shell task --init Custom.yml ``` -------------------------------- ### Group Output Error Only Example Source: https://taskfile.dev/llms-full.txt Illustrates the 'error_only: true' setting for 'group' output, showing that only the error message is displayed when a task fails. ```shell $ task passes $ task errors output-of-errors task: Failed to run task "errors": exit status 1 ``` -------------------------------- ### Define Task-Specific Variables Source: https://taskfile.dev/docs/guide Example of declaring a variable directly within a specific task's definition. This variable is only accessible when that task is executed. ```yaml version: '3' tasks: print-var: cmds: - echo "{{.VAR}}" vars: VAR: Hello! ``` -------------------------------- ### List All Tasks with Descriptions Source: https://taskfile.dev/docs/guide Use `task --list` or `task -l` to display all available tasks along with their descriptions. This helps users understand the available functionality. ```yaml version: '3' tasks: build: desc: Build the go binary. cmds: - go build -v -i main.go test: desc: Run all the go tests. cmds: - go test -race ./... js: cmds: - esbuild --bundle --minify js/index.js > public/bundle.js css: cmds: - esbuild --bundle --minify css/index.css > public/bundle.css ``` -------------------------------- ### Define a Taskfile Structure Source: https://taskfile.dev/docs/experiments/remote-taskfiles A basic example of a Taskfile configuration file, defining a default task that executes a sub-task. ```yaml version: '3' tasks: default: cmds: - task: hello hello: cmds: - echo "Hello Task!" ```