Roger-luo / Configurations.jl

Options & Configurations made easy.

Home Page:https://configurations.rogerluo.dev/stable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FR] Option for `from_toml` to check for file existance

fonsp opened this issue · comments

from_toml_if_exists(t, filename) = if isfile(filename)
	from_toml(t, filename)
else
	t()
end

Maybe this functionality can be a kwarg option for from_toml?

currently, the interface for from_xxx methods treats the kwargs as the override of a given configuration. so I can't let from_toml to have a keyword for this. But I think there should be a way of doing what you described above.

I'm doing a rewrite of this package now since it was a simple package, but now contains too much for one file :-P I'll include this as a new feature for the rewrite

actually after thinking about this again, I feel this can be provided by including the above function instead of overloading it to from_toml, the reason is not all option types can be created directly via t()