[WIP] Implement task params in spec#126
[WIP] Implement task params in spec#126leemeichin wants to merge 4 commits intodogtools:masterfrom leemeichin:params
Conversation
|
Hi @leemachin I will be out for a few days, will check this early next week. Thanks so much for jumping in! I want to start spending more time with the project again. |
|
No worries @xsb :) there's not much to look at now, I'm just opening it early to keep a track of what happens with it. |
|
Most of the parsing side is all sorted out. All that's left is the complicated stuff :)
|
Use a CLI parsing lib to build a command suite from the dogfile, as opposed to parsing args and seeing how they might map. This means a dogfile can potentially pass barewords args as well as flags. (e.g. `dog deploy master` as opposed to `dog deploy --branch=master`).
|
@xsb I'm going to push up WIP commits showing what I'm thinking with this (with most of it living in Basically, the current structure manually parses ARGV and does different things depending on the first character it detects (is it a flag, is it a task?). It does this before it even tries to parse the dogfile, which means that it has to parse and store args that might turn out to be invalid. I've pulled in a CLI library to help structure so essentially you are building an entire CLI tool from a YAML definition. This inverts that relationship so the dogfile needs to be valid before anything else, and it's used to build up the suite of commands. I felt this has made it easier to follow compared to doing it all from scratch, at the expense of pulling in an external dependency. |
Thought: is positional substitution preferable to named variables? e.g.
{{ .ParamName }}or$paramNameseems easier to follow than$1,$2,$3, etc...