refactoring: variable naming

This commit is contained in:
unknown 2020-03-20 19:14:01 +09:00
parent 95f2f73ed9
commit 3a4c016df7

View file

@ -1100,11 +1100,11 @@ func (c *Command) Commands() []*Command {
// AddCommand adds one or more commands to this parent command.
func (c *Command) AddCommand(cmds ...*Command) {
for i, x := range cmds {
if cmds[i] == c {
for _, x := range cmds {
if x == c {
panic("Command can't be a child of itself")
}
cmds[i].parent = c
x.parent = c
// update max lengths
usageLen := len(x.Use)
if usageLen > c.commandsMaxUseLen {