add check for already defined flag

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2022-03-25 14:06:21 +03:00
parent 7e5339802a
commit 1dd7e71881
2 changed files with 8 additions and 1 deletions

View File

@@ -60,7 +60,9 @@ func (c *flagConfig) Init(opts ...config.Option) error {
if vi == nil {
continue
}
if f := flag.Lookup(fn); f != nil {
return nil
}
switch vi.(type) {
case time.Duration:
err = c.flagDuration(sf.Value, fn, fv, fd)