Probably would be something like:
func (in InputInfo) DefaultFunc(fn func() (string, error)) InputInfo {
in.DefaultFunc = fn
return in
}
fn would be called when parsing kicks off to get the default value and feed it into the InputInfo's parser just as StrDefault currently works. Some thoughts:
- Does this need to be mutually exclusive with the current default? I think so.
- Should this be cached? Probably not. However, if so, maybe it can just be cached in
StrDefault if the above point holds, which I think it does.