Closed dsifford closed 7 years ago
Hi, thank you for the well-written description of your issue, and sorry it's taken me so long to get around to addressing it.
I actually modeled dotbot-pacaur
partly after dotbot-brew
, so they both handle things pretty similarly. I would expect the config below to work since dotbot-pacaur
and dotbot-brew
both use a for-in
loop iterate over the the values of a list which also just so happens to work on the keys of a dict.
- &common
? package1
? package2
- pacaur:
<<: *common
? linux-specific1
- brew:
<<: *common
? mac-specific1
This takes advantage of the merge key (<<) in YAML which joins maps since there isn't an equivalent for lists.
The downside with this is that you'll be getting an error when you run it.
Action package1 not handled
Action package2 not handled
This is a side-effect of how the YAML files are parsed. The &common
anchor will be treated as a list of directives that Dotbot will try to run.
To get around the problem you could call the common one brew
or pacaur
and remove the merge key like below which doesn't look great, but will fix the error.
- pacaur: &common
? package1
? package2
- pacaur:
? linux-specific1
- brew:
<<: *common
? mac-specific1
Let me know if this works. I haven't been able to try it out on the linux side of things yet, but it seems to work on my MacBook with brew
. If it does work, I'll add it to the README so other people trying to do this can find a solution more easily.
@ajlende Good idea! Just gave the last format you suggested a try on my linux machine and it works like a charm with no warnings. π π
Thanks for pointing me in the right direction π
Glad to hear it worked!
Hello,
Posting this request here from anishathalye/dotbot#122
My request is fairly simple. I'm in a situation where I'm jumping between a macbook and a linux machine and I'm using both
dotbot-pacuar
anddotbot-brew
to maintain a list of my packages for both machines.The lists contain, for the most part, the same exact packages with a few here and there differences.
Currently, there's no way to use reference anchors in the plugin yaml file so I have to write my package lists like this:
As you can see, there's a lot of unnecesary repeats between both lists.
What I'd like to do instead is this:
This almost works right now, but the hangup is that dotbot doesn't first flatten the lists prior to passing them to the plugins. So what the plugins end up getting is this:
Hope that makes sense. Thanks for considering! π