feat: added variable override flag --var#2388
Conversation
|
Hi @sashokbg, Thanks for your PR, but this is probably not the right direction as we already have a proper syntax for setting vars via the CLI: task my-task FOO=barSo in theory there's no need for: task my-task --var FOO=barThere's the priority thing, but add even one more way of setting vars would just make things even for confusing. |
|
Hello @andreynering I understand, I missed out that positional args are treated as vars. Can we please keep the variable overriding at least ? So that I can still run task my-task FOO=bar but the FOO from cli args will take precedence over the one defined in the template file (like is the case with many other cli tools). Thank you for your understanding |
|
@sashokbg The current behavior is by design. You should use https://taskfile.dev/docs/reference/templating#default-values-and-coalescing |
|
ok, it is all clear now @andreynering, thank you for your explanations. I worked on the overriding / defaults in relation to #2379 can you come check it please ? The idea is to have variables set by interactive input, but we need to handle the case on non-TTY shells and thus use defaults etc. Any comment and proposals would be really helpful. Thank you and have a nice day ! |
This PR adds a new --var flag that allows to override variables set in the Taskfile