Open
Description
Description
mkdir inputs
echo 'hello' > inputs/hello.txt
echo 'world' > inputs/world.txt
echo 'hello world' > inputs/"hello world".txt
$ ls -l inputs
total 24
-rw-r--r-- 1 chrislarose staff 12 Mar 24 17:22 hello world.txt
-rw-r--r-- 1 chrislarose staff 6 Mar 24 17:22 hello.txt
-rw-r--r-- 1 chrislarose staff 6 Mar 24 17:22 world.txt
Taskfile.yml
# https://taskfile.dev
version: '3'
tasks:
default:
cmds:
- for: { var: CLI_ARGS, as: FILENAME }
cmd: echo "{{.FILENAME}}"
Then
task default -- inputs/hello.txt inputs/world.txt inputs/"hello world".txt
produces unexpectedly
task: [default] echo "inputs/hello.txt"
inputs/hello.txt
task: [default] echo "inputs/world.txt"
inputs/world.txt
task: [default] echo "'inputs/hello"
'inputs/hello
task: [default] echo "world.txt'"
world.txt'
The command was executed 4 times, even though only 3 arguments were sent to task
after --
. I personally ran into this when trying to invoke task
using xargs
$ find inputs -type f | xargs task default --
task: [default] echo "inputs/world.txt"
inputs/world.txt
task: [default] echo "inputs/hello"
inputs/hello
task: [default] echo "world.txt"
world.txt
task: [default] echo "inputs/hello.txt"
inputs/hello.txt
Version
Task version: v3.42.1 (h1:HOaFbZGLOrAy2V/dLsX2rGJZVG2Qx6268KUIAIXdNE4=)
Operating system
macOS Sonoma 14.1.2
Experiments Enabled
No response