Open shpoont opened 1 month ago
You can do that and more with the shell:
$ export MYTASKFILE=foo.yaml
$ task --taskfile $MYTASKFILE
stat foo.yaml: no such file or directory
$ alias task='task --taskfile $MYTASKFILE'
$ task
stat foo.yaml: no such file or directory
$ alias task='task --taskfile ${MYTASKFILE:-Taskfile.yml}'
$ unset MYTASKFILE
$ task
stat Taskfile.yml: no such file or directory
More chance that it works too ... the internals of Task are not so easy.
@trulede Thanks, but this is not what I am looking for. Your example would work with single instance of go-task usage. If it is used in multiple places, it would mean that you must find all occurrences of usage of go-task and rewrite them to support this approach which makes this hardly practical.
It would be great to have the option to set the path to the Taskfile using an environment variable. This would be particularly useful in scenarios where the Taskfile is not located in the default path (e.g., Taskfile.yaml), allowing us to avoid specifying the path each time.