[fix] dup empty name check ignore #2

Merged
root merged 1 commits from fix/empty-key-dup-and-required into master 2020-12-13 14:57:07 +00: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")
}
}