Task

T

Task

Task is a task runner / build tool that aims to be simpler and easier to use than, for example, GNU Make.

Join

Defining flags/arguments for a task?

Heya! I just found this and from the docs I don't believe it's possible, but I was wondering if it was possible to define flags/options and arguments for tasks? For example, our project has a custom linting command and we want to have everything discoverable by a taskfile.yml (instead of having a combination of bash scripts, package.json aliases, random standalone executables, etc) Is there any plans to implement this, or any ways to get it somehow?...

How to check if ARGS count is not 0

Hello, I am trying to write a taskfile and want to ensure user must pass an arg. How to check this ?

dotenv inside included Taskfile

From docs: "Please note that you are not currently able to use the dotenv key inside included Taskfiles." Are there any plans to implement this, please? Especially when using dotenv on task level in included Taskfile works: included Taskfile:...

Problems with include files

I'm working with 2 Taskfiles. The first one are for public task in the second exists internal tasks . In the first one i had this: ```yaml...
No description

task for dummies?

task documentation is pretty harsh for people who aren't so savvy. For example I was looking for a way to do a -ex in all the shells. I couldn't find a way and evntually gave up and just slapped a 'set -ex' about as needed. The other day I let an AI assistant muck with one of my taskfiles and it added essentially the long form of 'set: [e, x]' to the taskfile on its own accord. I see that set-and-shopt section on the website and it really doesn't give me any idea of that possibility. A lot of things in task reference other code, like text/template and seem to assume a familiarity with them. But I'm honestly not very experienced with stuff. Where is the task for dummies? I would really like to see snippets, examples, cool frobnitz, and best practices. task info is really hard to track down....

Convert string variable to integer

I'd like to convert my string variable to an integer, how can I do it? Are the some conversion functions supported by the templating language?

Watching golang source w net/http server

my problem is when i run this task, it doesn't tear down the command, so port will be busy on refresh, i am just a beginer in task, plz help me in this version: '3' interval: 3s...

Rerun task on dep build.

Is there a way to make a task run when one of it's deps was rebuilt in the current run

Parentheses in commands

I understood I should escape () parentheses, but how do I do it? Backslashes did not work, task says: task: Failed to parse Taskfile.yml: yaml: line 16: found unknown escape character

Boolean value keeps evaluating as false

Hello everyone, I'm trying to do something like this: ```yaml vars: with_elastic: sh: |...

Is this the best way to create a list (that can be empty) for use with templates?

```yml VENV_TO_INSTALL_STR: sh: |- for pkg in "{{join "" "" .PYTHON_PACKAGES}}"; do echo '{{.VENV_ALL_PACKAGES}}' | grep -q "{"name": "$pkg"" || echo "$pkg"...
Solution:
You could use compact instead of initial. This would remove any empty items from your array. Alternatively, you can build a JSON string and call fromJson. There are probably other ways too. Regarding ref. By design, it only accepts a single ActionNode (i.e. One set of {{...}}) so if statements are not possible. ref is designed for you to be able to refer to other variables while maintaining their type, not for logic. It is actually a side-effect of the templating engine that functions are available for use in ref, but we felt this was acceptable/useful....

Is it possible to to specify a Go version in a Taskfile?

When building a Taskfile.yml, is it possible to specify the Go version used when building the application? This is all I have in my Taskfile.yml: ```yaml...

variable for current taskfile?

Is there a variable can be used in taskfile works like __dirname in js , which is the directory of current taskfile.yaml ? for example, when CWD= /home/user/src/project1/internal/, running task with /home/user/src/project1/taskfile.yaml, a variable for /home/user/src/project1/...

Does precondition support go templates?

It seems that preconditions don't support the templates, or if they do, I'm unable to figure it out.

What environment anad shell are task commands executed in?

I am trying to evaluate the result of a command which pipes through tee so that output of the command is logged to the STDOUT and saved in a file at the same time. The idea is to then invoke a script that logs the outcome of the command depending on the exit code in a file. ```yaml task:...
Solution:
found it! if you put everything you want in a script and invoke the script as follows: ```shell...

Continue on error

Is there a functionality that could make a task continue execution even there is an error ? Context: I am trying taskfile to do CI checks....

dotnev variable value calculation

Hello ! I canot find anything in the docs so I decided to ask here: Is there some sort of prioirity in the dotenv declaraion?...
Solution:
Hello ! It'll be true. Dotenv files are processed in the order they are defined. If an environment variable already exists, it won't be overridden....

yaml formatted data

Assuming a variable ARRAY like in https://taskfile.dev/blog/any-variables/#arrays , but YAML formatted. Is it possible, loop over a variable containing YAML formatted data (in this case a list) either inline or loaded from a .yaml file with templating functions? example data: ```...

Precondition with OR does not work

Hey all, I have a build pre condition that checks two things: production or version. If the build is production I want to validate the version in my pre condition and if the build is not production I want to continue successfully without validating the version. When I run the two expression together it fails even when I specify PRODUCTION = false. That is, if I pass PRODUCTION == false I want to skip validating the version and continue successfully and if PRODUCTION == true I want to validate the version with my regex and fail if it is not a valid format. Here is my pre condition:...
Next