-
-
Notifications
You must be signed in to change notification settings - Fork 625
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
Specify Taskfile location in environment variable. #1721
Comments
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. |
@shpoont The alias command does exactly what you wanted. You don't need to rewrite anything, just add the alias and export to your bash profile. alias task='task --taskfile ${MYTASKFILE:-Taskfile.yml}' That will work everywhere. IMHO it easier to just name the files Taskfile.yml, that in its own is communicating something. |
@trulede I never said that I wanted to run go-task within an interactive bash session. Furthermore, I didn't say that my goal was simply to rename Taskfile.yml. Your proposed solution requires a POSIX-compliant shell running in interactive mode. This requirement makes it impractical for various scenarios, including scripts using subshells, CI/CD pipelines, running go-task as child process of non-shell program - among other potential use cases. I'm looking for a proper feature implementation, not a workaround. |
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.
The text was updated successfully, but these errors were encountered: