You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
282 B
Go
20 lines
282 B
Go
2 years ago
|
package sutil
|
||
|
|
||
|
import "github.com/urfave/cli/v2"
|
||
|
|
||
|
func AppendFlag(flags []cli.Flag, flag cli.Flag) []cli.Flag {
|
||
|
has := false
|
||
|
for _, f := range flags {
|
||
|
if f.Names()[0] == flag.Names()[0] {
|
||
|
has = true
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if has {
|
||
|
return flags
|
||
|
}
|
||
|
|
||
|
return append(flags, flag)
|
||
|
}
|