Closed pixel27 closed 5 years ago
I'd like to add the ability to create the configuration if it doesn't exist. My inclination would be to change:
ConfParse(filename::AbstractString, syntax::AbstractString="")
to
ConfParse(filename::AbstractString, syntax::AbstractString="", createif::Bool=false)
then modify the open to be:
fh = open(filename, !createif ? "r" : "r+")
Which would ensure it doesn't break any existing code. Does this seem reasonable? If you'd like it implemented a different way, I'd be happy to do the work if you give me an idea of how you'd like to see it.
I ended up just doing
local conf = ConfParse(filename, "simple") if lstat(conf_file).inode != 0 parse_conf!(conf) end
in my code, it's probably cleaner.
I'd like to add the ability to create the configuration if it doesn't exist. My inclination would be to change:
ConfParse(filename::AbstractString, syntax::AbstractString="")
to
ConfParse(filename::AbstractString, syntax::AbstractString="", createif::Bool=false)
then modify the open to be:
fh = open(filename, !createif ? "r" : "r+")
Which would ensure it doesn't break any existing code. Does this seem reasonable? If you'd like it implemented a different way, I'd be happy to do the work if you give me an idea of how you'd like to see it.