Skip to content

Commit

Permalink
ignore children of ignored field (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
wesdean authored Feb 19, 2022
1 parent 8bb794a commit e019cd5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions flagset.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ func (f *FlagSetFiller) walkFields(flagSet *flag.FlagSet, prefix string,
field := structType.Field(i)
fieldValue := structVal.Field(i)

if flagTag, ok := field.Tag.Lookup("flag"); ok {
if flagTag == "" {
continue
}
}

switch field.Type.Kind() {
case reflect.Struct:
err := f.walkFields(flagSet, prefix+field.Name, fieldValue, field.Type)
Expand Down

0 comments on commit e019cd5

Please sign in to comment.