Compare commits

...

2 Commits

Author SHA1 Message Date
Jay
113f1a1945 Merge pull request '[fix] dup empty name check ignore' (#2) from fix/empty-key-dup-and-required into master
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Reviewed-on: #2
2020-12-13 14:57:05 +00:00
Jay
6f460a33db [fix] dup empty name check ignore
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2020-12-13 22:56:38 +08:00

View File

@ -39,7 +39,7 @@ func New() *Parser {
func (p *Parser) addArg(a *arg) error {
for _, v := range p.args {
if v.sname == a.sname || v.lname == a.lname {
if (a.sname != "" && v.sname == a.sname) || (a.lname != "" && v.lname == a.lname) {
return errors.New("option name dup")
}
}