-
-
Notifications
You must be signed in to change notification settings - Fork 763
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_DIRwhich contains the directory where task has been called from, but does not honor the-d <dir>command line parameter
andTASK_DIRwhich merely contains what has been configured underdir:in a task of theTaskfile.ymlfile and does not even resolve template expressions.
I see two different solutions to this problem:
Either change the behavior ofUSER_WORKING_DIRso that it takes the-dparameter 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_DIRwhich 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.