Skip to content

add DefaultFunc for default values that need to be generated #10

@steverusso

Description

@steverusso

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions