This is a bit silly. I'm having to use 5 lines in the file when one would clearly do. Repeat this across the three invocations I need to install ZSH dependencies and whatnot, and I have a pretty busy file.
I'd like to accomplish this by threading the module name down into a template variable. For the purposes of discussion, let's call it {{module.name}}.
My current code has a parameter, package, that controls which package will be installed. This is a required variable. But if we added this as a template variable, I could instead define package as:
param "package" {
default = "{{module.name}}"
}
At that point if I specified a "package" in a module call it would be used. If it is not specified, the three-installs-in-three-lines calls above will kick in.
When we call a module, it looks like this:
We refer to this subgraph as
module.foo
. This works! But there's more we could do with this name parameter (foo
here.)I'm working on moving my dotfiles to Converge, and I get this pattern all over the place:
This is a bit silly. I'm having to use 5 lines in the file when one would clearly do. Repeat this across the three invocations I need to install ZSH dependencies and whatnot, and I have a pretty busy file.
What I would like to write is this:
One line per install. Much better!
I'd like to accomplish this by threading the module name down into a template variable. For the purposes of discussion, let's call it
{{module.name}}
.My current code has a parameter,
package
, that controls which package will be installed. This is a required variable. But if we added this as a template variable, I could instead definepackage
as:At that point if I specified a "package" in a module call it would be used. If it is not specified, the three-installs-in-three-lines calls above will kick in.