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
|
// Look at the tag
|
||||||
var isSubcommand bool // tracks whether this field is a subcommand
|
var isSubcommand bool // tracks whether this field is a subcommand
|
||||||
if tag != "" {
|
|
||||||
for _, key := range strings.Split(tag, ",") {
|
for _, key := range strings.Split(tag, ",") {
|
||||||
|
if key == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
key = strings.TrimLeft(key, " ")
|
key = strings.TrimLeft(key, " ")
|
||||||
var value string
|
var value string
|
||||||
if pos := strings.Index(key, ":"); pos != -1 {
|
if pos := strings.Index(key, ":"); pos != -1 {
|
||||||
|
@ -357,7 +359,6 @@ func cmdFromStruct(name string, dest path, t reflect.Type) (*command, error) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
placeholder, hasPlaceholder := field.Tag.Lookup("placeholder")
|
placeholder, hasPlaceholder := field.Tag.Lookup("placeholder")
|
||||||
if hasPlaceholder {
|
if hasPlaceholder {
|
||||||
|
|
Loading…
Reference in New Issue