-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Task parameters #31
Comments
Potential solution to var evaluation order based on using a sub-task for it: default:
deps:
- ^markdown IN=src/*.md
markdown:
deps:
- setout # should get IN passed along.
cmds:
- markdown {{.IN}} -o {{.OUT}}
sources:
- {{.IN}}
generates:
- {{.OUT}
setout:
vars:
OUT: {{.IN | trimSufix ".md"}}.html
This saves us from adding a new keyword Not that we necessarily need glob support as input from the start, but it's nice to know that the design we choose from the start will be capable of supporting it. |
@smyrman Advanced cases seems to be a bit tricky. I think I'll start this in another branch and ask you (and other) for feedback before it is stable and can me merged on master. I think in this case you should probably repeat the glob: task:
cmds: [...]
vars:
IN: {{glob "./**/*.md"}}
OUT: {{glob "./**/*.md" | trimSuffix ".md"}} Note the |
I guess you want/have to set this when you call the task though? two-deps:
deps:
- markdown IN={{glob "./**/.md"}} OUT={{glob "./**/*.md" | trimSuffix ".md"}}.html Even in this case, if glob returns a slice, I don't know what trimSuffix would do, and I don't think the .html would be appended as if it was a string. Not saying this example syntax is necessarily what we should go for, but part of the goal would be to allow for that one to one mapping within the task itself.
Awesome 👍 |
Just to be clear, all we specifically need atm. would be the base implementation, without any GLOB support or similar, so that's a very good start. The advanced usage can come later. |
@smyrman Agreed. I don't think the basic idea is hard to implement. I may give a try this weekend. |
I will have a look:-) |
Done on master If there is any improvement still not possible, please open another issue. |
As of the discussion in #29, I believe we could solve part of the problem by allowing for task parameters to be implemented with the following semantics:
Base implementation
Example syntax:
Glob support & vars evaluation order
Ideally, there would also be a way to set multiple deps and/or call the task multiple times sequentially using using a glob pattern. An example glob task might look like:
For the "vars" section in this example, it might be necessary that vars are handled in the order they are listed, which, depending on implementation here, might be hard if Go maps are used. It could also be that YAML don't like that the IN variable is empty.
If this proves to be a problem, and we also want to enforce that all task parameters are set, we could consider to add an additional keyword "args", where the semantics are to allow args to be set before vars:
The text was updated successfully, but these errors were encountered: