Merge pull request #120 from alexflint/dedent-tag-loop
Move empty tag check inside loop
This commit is contained in:
commit
a68c3d0653
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