Description
Description
There are various special variables available but none of them reflects the working directory of a respective task. The ones that come closest are:
USER_WORKING_DIR
which contains the directory where task has been called from, but does not honor the-d <dir>
command line parameter
andTASK_DIR
which merely contains what has been configured underdir:
in a task of theTaskfile.yml
file and does not even resolve template expressions.
I see two different solutions to this problem:
Either change the behavior ofUSER_WORKING_DIR
so that it takes the-d
parameter into account, because I see only very little benefit in having a variable which contains the directory where task has been called from when a different working directory has been explicitly set with-d
- Introduce a new variable such as
TASK_WORKING_DIR
which contains the desired dir and does not break the current behavior ofUSER_WORKING_DIR
.
The current use case which I have is as follows: I have a root directory containing a Taskfile.yml
file and some subdirectories which doesnt have Taskfiles.yml
files. I now want to reuse the logic of the Taskfile.yml
from the root directory in the subdirectories as described here. This works well if I navigate to a subdirectory and call the respective task from there, however, when I call task from the root directory and specify the subdirectory with the -d
parameter it doesnt work as USER_WORKING_DIR
still contains the root directory as outlined above.