Skip to content

Commit

Permalink
delete the method AllSubGroups from OptGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
xgfone committed Jun 13, 2019
1 parent a7349ee commit 7281031
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions group.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,30 +108,6 @@ func (g *OptGroup) G(group string) *OptGroup {
return g.Group(group)
}

// AllSubGroups returns all the sub-groups of the current group.
//
// If the current group is the default, it will returns all groups,
// containing the default group.
//
// Notice: "group1.group2.group3" and "group1.group2" are the sub-group of "group1".
func (g *OptGroup) AllSubGroups() []*OptGroup {
var gname string
if name := g.Name(); name != "" {
gname = name + g.conf.gsep
} else {
return g.conf.AllGroups()
}

allGroups := g.conf.AllGroups()
groups := make([]*OptGroup, 0, len(allGroups))
for _, group := range allGroups {
if strings.HasPrefix(group.Name(), gname) {
groups = append(groups, group)
}
}
return groups
}

// AllOpts returns all the options in the current group.
func (g *OptGroup) AllOpts() []Opt {
g.lock.RLock()
Expand Down

0 comments on commit 7281031

Please sign in to comment.