An issue common to both clapconf and clapenv is that Parse()
also validates the input. When all we're dealing with is command-line args, this is fine, but when multiple engines can provide data, it causes a sort of race condition for mandatory arguments. If conf and env are loaded first, then we have an issue when the user tries to use command-line args that are also specified in (e.g.) environment variables: claptrap will throw a "too many arguments" error. If conv and env are loaded last, then the validation performed during Parse()
happens before the values from conf and env are loaded.
Providing a non-validating Parse
(say, claptrap.Load()
) and exposing Validate
would allow the tools to load any missing values and then call Validate
themselves. In this case, we'd constrain the tools to be run after claptrap.Load()
, and have them call the claptrap.Validate()
when they're done:
claptrap.Load(nil)
clapenv.Load()