writ
writ copied to clipboard
Expose default values as a "Default" field on Options
@elithrar provided some great feedback on the default value handling. After some thought, I've put together a PR that decouples the OptionDefaulter
and OptionDecoder
interfaces. With this change, Options would have a separate Default
field. As a result, string defaults can be assigned via opt.Default = writ.StringDefault("value")
, and a ChainedDefault
can be used to chain together defaults from a []Defaulter
slice, returning the first non-empty default. This is how environment defaults are stacked with regular defaults with this PR.
If I merge this, I'll target the merge for the v1.0 release. I think I'll probably collect breaking changes and merge them to a separate 1.0-wip branch.