Description
When dotenv is configured at the root level of a Taskfile, {{.CLI_ARGS}} is always empty even when arguments are passed after -- on the command line.
Reproduction:
.env (any valid env file):
Taskfile.yml:
version: '3'
dotenv: ['.env']
tasks:
test:
cmds:
- echo "args={{.CLI_ARGS}}"
Run:
go-task test -- hello world
Expected output:
args=hello world
Actual output:
args=
Notes"
- Removing
dotenv from the Taskfile makes {{.CLI_ARGS}} work correctly
$CLI_ARGS as a shell variable is also empty — it is not exported to the environment
- Tested on go-task version 3.49.0 on Linux
Workaround:
Pass arguments as prefixed environment variables instead:
EMAIL=foo@bar.com go-task mytask
Version
3.49.0
Operating system
Alpine Linux 3.24.0_alpha20260127 with kernel 6.18.2
Experiments Enabled
No response
Example Taskfile
version: '3'
dotenv: ['.env']
tasks:
test:
cmds:
- echo "args={{.CLI_ARGS}}"
Description
When dotenv is configured at the root level of a Taskfile,
{{.CLI_ARGS}}is always empty even when arguments are passed after--on the command line.Reproduction:
.env (any valid env file):
Taskfile.yml:
Run:
go-task test -- hello worldExpected output:
args=hello worldActual output:
args=Notes"
dotenvfrom the Taskfile makes{{.CLI_ARGS}}work correctly$CLI_ARGSas a shell variable is also empty — it is not exported to the environmentWorkaround:
Pass arguments as prefixed environment variables instead:
EMAIL=foo@bar.com go-task mytaskVersion
3.49.0
Operating system
Alpine Linux 3.24.0_alpha20260127 with kernel 6.18.2
Experiments Enabled
No response
Example Taskfile