move empty tag check inside the loop
This commit is contained in:
parent
2a3b5ea3cb
commit
6be0398e80
5
parse.go
5
parse.go
|
@ -292,8 +292,10 @@ func cmdFromStruct(name string, dest path, t reflect.Type) (*command, error) {
|
|||
|
||||
// Look at the tag
|
||||
var isSubcommand bool // tracks whether this field is a subcommand
|
||||
if tag != "" {
|
||||
for _, key := range strings.Split(tag, ",") {
|
||||
if key == "" {
|
||||
continue
|
||||
}
|
||||
key = strings.TrimLeft(key, " ")
|
||||
var value string
|
||||
if pos := strings.Index(key, ":"); pos != -1 {
|
||||
|
@ -357,7 +359,6 @@ func cmdFromStruct(name string, dest path, t reflect.Type) (*command, error) {
|
|||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
placeholder, hasPlaceholder := field.Tag.Lookup("placeholder")
|
||||
if hasPlaceholder {
|
||||
|
|
Loading…
Reference in New Issue