Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added TASKFILE_DIR template variable #224

Closed

Conversation

Shivakishore14
Copy link

@Shivakishore14 Shivakishore14 commented Jun 28, 2019

Added TASKFILE_DIR template variable to access the directory where the task file is located.

example:

version: '2'

tasks:
    build: 
        cmds:
            - echo '{{TASKFILE_DIR}}'

output

$ task build
echo '/Users/coda/go/src/github.com/go-task/task/cmd/task'
/Users/coda/go/src/github.com/go-task/task/cmd/task

closes #215

@andreynering
Copy link
Member

Hi @Shivakishore14, and thanks for opening this PR.

Unfortunately, there are use cases which won't properly work with this patch.

  1. If someone use --dir to run a Taskfile in another directory, this will return the wrong directory
  2. This will also return the wrong directory for included Taskfiles
  3. Probably other similar use cases

I think this will be more easily done correctly if added as a variable instead of a function.

So, since I realized this isn't as simple, I just removed the good first issue from #215 and will close this for now.

Feel free to ping me if you have any questions or comments. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dirname of current Taskfile
2 participants