Skip to content

Commit 9bb00e2

Browse files
committed
fix(extFlag): extFlag doesn't set default value prior to parsing
* `extFlag.PreParse()` will set the value to that of `flag.DefValue`.
1 parent e908328 commit 9bb00e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

flag_ext.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ type extFlag struct {
77
}
88

99
func (e *extFlag) PreParse() error {
10+
if e.f.DefValue != "" {
11+
return e.Set("", e.f.DefValue)
12+
}
13+
1014
return nil
1115
}
1216

0 commit comments

Comments
 (0)