mirror of
https://github.com/spf13/cobra
synced 2025-05-07 13:57:21 +00:00
refactoring: variable naming
This commit is contained in:
parent
95f2f73ed9
commit
3a4c016df7
1 changed files with 3 additions and 3 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue