deadc0de6 / dotdrop

Save your dotfiles once, deploy them everywhere
https://dotdrop.readthedocs.io
GNU General Public License v3.0
1.78k stars 105 forks source link

[feature] TOML configuration file support #343

Closed FunctionalHacker closed 2 years ago

FunctionalHacker commented 2 years ago

It would be awesome if we could use TOML instead of YAML to configure dotdrop. I could pretty easily whip up a script which converts TOML to YAML on the fly but I wanted to see first if there was interest to include support in dotdrop itself.

deadc0de6 commented 2 years ago

That should work since I'm actually simply matching yaml to a dict so doing the same for toml should be possible (modulo such a lib exists). Let me take a look at this and get back to you.

Just for my own interest why toml instead of yaml, what would be the benefit of using the config in toml rather than yaml?

FunctionalHacker commented 2 years ago

That should work since I'm actually simply matching yaml to a dict so doing the same for toml should be possible (modulo such a lib exists). Let me take a look at this and get back to you.

Awesome!

Just for my own interest why toml instead of yaml, what would be the benefit of using the config in toml rather than yaml?

I just hate YAML for it's oddities and in general I don't enjoy programming languages/markup languages that are whitespace sensitive. TOML is just a strictly typed INI file and I love the simplicity.

deadc0de6 commented 2 years ago

I made a little script to play with toml and yaml and it seems first that two elements might not be properly parsed:

deadc0de6 commented 2 years ago

@FunctionalHacker dotdrop is now able to load a toml config file. It is currently quick-n-dirty but might allow us to play with it before I go any further. It is available in the toml branch, can you give it a try with your config?

I made a basic convertor yaml-to-toml.py. It probably doesn't cover all corner cases but ideally users should either start with yaml or toml and rarely convert. But I will handle conversion issues along the way.

I also provided a base config file config.toml where unfortunately the two mandatory entries dotfiles and profiles are not present since toml doesn't have the notion of empty/nil/nul/null. It will still work as this is patched by dotdrop on load.

Please let me know if it works for you. Once we are happy, I'll clean a bit and refactor (and document) and I will publish a new release with toml support.

deadc0de6 commented 2 years ago

@FunctionalHacker toml support will be part of the next release.

deadc0de6 commented 2 years ago

@FunctionalHacker this is now available in version v1.9.0

FunctionalHacker commented 2 years ago

Awesome! Thanks for your hard work!