ApplyDefaults() now only applies defaults if the value is not already otherwise set.

This commit is contained in:
Alec Thomas
2019-06-12 13:25:33 +10:00
parent 0d256bb68a
commit 7be398e79f
6 changed files with 115 additions and 18 deletions
+3
View File
@@ -197,6 +197,9 @@ func (k *Kong) Parse(args []string) (ctx *Context, err error) {
if ctx.Error != nil {
return nil, &ParseError{error: ctx.Error, Context: ctx}
}
if err = ctx.Reset(); err != nil {
return nil, &ParseError{error: err, Context: ctx}
}
if err = k.applyHook(ctx, "BeforeResolve"); err != nil {
return nil, &ParseError{error: err, Context: ctx}
}