From 6f460a33db65d64ae60a4f5cac46de8f1e152ca5 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 13 Dec 2020 22:56:38 +0800 Subject: [PATCH] [fix] dup empty name check ignore --- argparse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/argparse.go b/argparse.go index 37a5da1..b1f2509 100644 --- a/argparse.go +++ b/argparse.go @@ -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") } } -- 2.45.2