Skip to content

Commit

Permalink
Cleanup: Remove unnecessary intermediate variables
Browse files Browse the repository at this point in the history
  • Loading branch information
1ambd4 committed Jan 10, 2024
1 parent 7656c5f commit c3abd2a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
4 changes: 0 additions & 4 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ func (a *App) Setup() {
a.separator.disabled = true
}

var newCommands []*Command

for _, c := range a.Commands {
cname := c.Name
if c.HelpName != "" {
Expand All @@ -239,9 +237,7 @@ func (a *App) Setup() {
c.separator = a.separator
c.HelpName = fmt.Sprintf("%s %s", a.HelpName, cname)
c.flagCategories = newFlagCategoriesFromFlags(c.Flags)
newCommands = append(newCommands, c)
}
a.Commands = newCommands

if a.Command(helpCommand.Name) == nil && !a.HideHelp {
if !a.HideHelpCommand {
Expand Down
3 changes: 0 additions & 3 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,12 @@ func (c *Command) setup(ctx *Context) {
}
sort.Sort(c.categories.(*commandCategories))

var newCmds []*Command
for _, scmd := range c.Subcommands {
if scmd.HelpName == "" {
scmd.HelpName = fmt.Sprintf("%s %s", c.HelpName, scmd.Name)
}
scmd.separator = c.separator
newCmds = append(newCmds, scmd)
}
c.Subcommands = newCmds

if c.BashComplete == nil {
c.BashComplete = DefaultCompleteWithFlags(c)
Expand Down

0 comments on commit c3abd2a

Please sign in to comment.