Skip to content

special variable for absolute path of task directory #1959

@vmaerten

Description

@vmaerten

Discussed in #1957

Originally posted by lesomnus December 14, 2024
Assume I run following taskfile at /home/lesomnus/foo:

version: "3"

tasks:
  hello:
    dir: bar
    cmds:
      - echo $(pwd)

It will print /home/lesomnus/foo/bar.
However, I believe it should be templated rather than executing pwd.

There was an issue about it at #525 but is closed as duplication of #215 but #215 does not state that.

Maybe I can:

version: "3"

tasks:
  gen-proto:
    dir: proto
    vars:
      PWD:
        sh: pwd
    cmds:
      - echo {{.PWD}}

but it is too verbose.

Is there already a special variable for this?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions