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

In included file, cannot set task dir with a variable containing absolute path

I often set the dir of a task through a variable, as shown at multiple places in the docs, e.g. at: https://taskfile.dev/usage/#looping-over-your-tasks-sources. However, for included files, this works not correctly if the path is absolute. For included files, it seems to be impossible to set the dir to an absolute path using a variable. root file: Taskfile.yaml...
No description

dotenv merges in inverse order?

Hi, when specifying two dotenv files that contain common keys, it seems that priority is given to the first file instead of the last file. This seems counter-intuitive to me and is the opposite of what was found in https://discord.com/channels/974121106208354339/1064231491883782215/1064231491883782215. first.env: ``` A=a...
Solution:
IIRC there was some discussion at the time on the priority order. We made a deliberate decision to implement this way. The idea is to follow the behavior of how .env files usually work. They do not override values that are already set on the ENV. In the same way, we loop over the list of .env files and only set the ENVs that were not previously set....

Task is not tracking deleted generated files

Hello, I think I found the case to reopen this issue: https://github.com/go-task/task/issues/238 I want the Task to re-trigger gen, when I'm running clean: ...

Task: <name> is up to date even if run: when_changed.

Hello. Do I understand correctly that the message above is not an error and will always be displayed even if task is not needed? Or did I set something up wrong and it shouldn't be there? If it always shows up, can I hide it? That is, I would like to not deduplicate unnecessary tasks within one run, but not show this message at all if the task does not start for this reason. In other words, this message is not needed, because I can already see that task: [name] was not called from the output....
No description

Task and tracking dir modtime

Hello. Let's say I'm changing tools/cmd/main.go and want to make a task that will track it by pattern. I know that this pattern will track any file in dir recursively. ```yaml check:...
Solution:
Hi @sedyh, This happens because Task actually ignores directories and only cares about files....

Run command for each source found by pattern without find.

Hello, is there a coreutils-free alternative for something like: ```yaml gen: sources: [internal/*_src.go]...

Requires vars and CLI_ARGS cohabitation ?

I would like to simplify the usage of task and vars when using the cli ``` tasks: default:...

Run watch first time

Hi there, Is there a way with a watch command to force it to run the first time it's started. Even if none of the files have changed. In this case I'm thinking of a web server. ```...

How can I create an internal task which will generate env variables for the main task?

Hello everyone! I am using Taskfile as a short cli helper to run my tests. Each time I am running task, i have to generate new env variables, is there a way to do smth similar via a sub-task? For example:
``` gen-env: env: SERVER_PORT:...

[Question] Best practice around "remote" taskfiles

As part of Wails v3, we're introducing "Services" which are a little like plugins, but provide additional features. These will be published as Go modules. In certain scenarios, it would be great to also distribute a Taskfile to add functionality to the main build system. I'm aware people can opt into Remote Taskfiles and then access the Taskfile via a URL, but there's a few concerns: 1. Keeping it in sync with any module updates 2. Being transparent about what is being run 3. Allowing them to customise the task ...

How to define global variables for all taskfiles

Hello. Could you please help me. I can't find a way how to define global variables for all Taskfiles. I have a lot of Taskfiles and want to define some "user-defined" variables that will be applied for all Taskfiles, but can't find a way how to do it. I tried to create some Taskfile ``` version: '3'...

How to reuse code in taskfile?

I have a lot of commands which all begin with the same code, and I'd like some clever way to reuse them. I found out I can do it with vars, but the problem is that I would like to keep the calls short and sweet, and using var changes the height of each method from 1 line to 4 😮 Is there some other, more concise method?

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...
Next