Repeat context statement because of a is a pointer

performance  optimization
gofmt  code
This commit is contained in:
leonardyp
2016-02-04 15:25:41 +08:00
parent cf1f63a727
commit 6f6e8caf6c
3 changed files with 11 additions and 19 deletions

View File

@@ -192,7 +192,7 @@ func (c Command) startApp(ctx *Context) error {
if c.HelpName == "" {
app.HelpName = c.HelpName
} else {
app.HelpName = fmt.Sprintf("%s %s", ctx.App.Name, c.Name)
app.HelpName = app.Name
}
if c.Description != "" {
@@ -231,12 +231,9 @@ func (c Command) startApp(ctx *Context) error {
app.Action = helpSubcommand.Action
}
var newCmds []Command
for _, cc := range app.Commands {
cc.commandNamePath = []string{c.Name, cc.Name}
newCmds = append(newCmds, cc)
for index, cc := range app.Commands {
app.Commands[index].commandNamePath = []string{c.Name, cc.Name}
}
app.Commands = newCmds
return app.RunAsSubcommand(ctx)
}