-
-
Notifications
You must be signed in to change notification settings - Fork 641
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
Support any variables #1421
Support any variables #1421
Conversation
Done some more bug bashing today 🐞 This is starting to feel somewhat stable from my end. Had a bizarre GH actions issue with the linter, but updating to the latest @andreynering Would love to get this experiment merged as a draft for the next release if possible. Any immediate thoughts? I think the main decision for this experiment is going to be whether we should support maps (and remove |
1658a3c
to
2d42e5b
Compare
@pd93 Great work so far! I think the easier decision for now is to remove support for maps so we can release the experiment for now. We can then decide later if we want to add that support back. I'd say that arrays will probably be a lot more used and useful than maps, so supporting that is the priority, anyway. And yes, I can postpone the next release to tomorrow or Friday if needed, so you have time to address that and it'll be included the release. 😉 |
task: Failed to parse Taskfile.yml:
yaml: line 51: cannot unmarshal !!seq into variable
EDIT: Nevermind, I forgot to set |
…s experiment enabled
… avoid empty interface errors in the templater
2d42e5b
to
2ce18af
Compare
This is the first iteration of the "Any Variables" experiment that allows users to use any type in their Taskfile variables. In this PR:
TASK_X_ANY_VARIABLES
experiment flagVar.Static
->Var.Value
Var.Value
to anany
typeany
type instead of just strings when the experiment flag is enabled.for
supports arrays when looping over a variablesh
with the experiment enabledThere are no tests in this PR as its an experiment. However, I have added a Taskfile in
testdata/vars/any
which can be used to try out the functionality:go run ./cmd/task --dir testdata/vars/any
The main things I'm looking for feedback on are:
any
variables)sh
) to define the command. This is incompatible with map variables as they would be defined the same way. This means that dynamic variables are now defined by starting a string variable with the$
character instead.sh
syntax. This would make this change non-breaking and it could be merged into v3 rather than waiting for a major version bump. However, you won't be able to define variables as maps at all.