You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Construct a provider representing data to be written
Construct a figment to read the config file
Merge the provider into the figment
Extract (complete) data from figment
Write data
But:
this writes out default values for all parameters not specified via the provider or input file
this loses any comments in the source
output order of file bears no resemblance to input order
There are two parts to fixing this:
filtering data to that which needs to be written, which could perhaps be done with Figment::find_metadata but probably requires a new method or using Provider::data directly
merging this into the file, in order, and ideally including comments: requires using something like toml_edit instead of the toml crate
Does anything close to that exist, or will I have to roll my own?
Not in this crate, at least not specifically. You could certainly serialize any structure into any kind of format and write it out (as the comment above), but that would mean rewriting the user's config with your own equivalent version which wouldn't maintain formatting. To do so while maintaining formatting is rather specialized, and crates like toml-edit exist for that reason.
I'm curious if there's any support or way built in to write out values to a config file?
I'd like to write something similar to how
git config
works, where you can do`git config --global A.B=C"
and it writes that value out to the global git config. Does anything close to that exist, or will I have to roll my own?
The text was updated successfully, but these errors were encountered: