go-task / task

A task runner / simpler Make alternative written in Go
https://taskfile.dev
MIT License
11.36k stars 613 forks source link

Run cmd from env: did not find expected '-' indicator #450

Closed Antonboom closed 3 years ago

Antonboom commented 3 years ago

Example Taskfile showing the issue

version: '3'

silent: true

vars:
  APP: ./bin/some-backend

tasks:
  version:
    desc: Show app version.
    cmds:
      - {{.APP}} version
▶ task  version
yaml: line 11: did not find expected '-' indicator

But this works ok:

    cmds:
      - "{{.APP}} version"
▶ task  version

release: "taskfile"
buildDate: "2021-03-17T12:33:34"
branch: "taskfile"
andreynering commented 3 years ago

Hi @Antonboom, thanks for opening this issue!

This is an YAML parse issue. YAML disallows { after -, so there's nothing we can do about it. Sorry.

You just need to quote the string as you did in your second example.

Antonboom commented 3 years ago

Thanks!

MrBr-github commented 2 years ago

@andreynering It'll be nice if comment about this behaviour could be added to the documentation

ghostsquad commented 2 years ago

@MrBr-github if this happens to be a common pitfall, I don't mind a small note/reminder about this somewhere in the docs.

However, it's out of scope for task to also document how yaml works. There is a link on the home page though to the YAML Schema

I'm making a note to add this documentation at minimum for v4.

MrBr-github commented 2 years ago

Thank you Much appreciated