mirror of
https://github.com/spf13/cobra
synced 2025-05-07 22:07:23 +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.
|
// AddCommand adds one or more commands to this parent command.
|
||||||
func (c *Command) AddCommand(cmds ...*Command) {
|
func (c *Command) AddCommand(cmds ...*Command) {
|
||||||
for i, x := range cmds {
|
for _, x := range cmds {
|
||||||
if cmds[i] == c {
|
if x == c {
|
||||||
panic("Command can't be a child of itself")
|
panic("Command can't be a child of itself")
|
||||||
}
|
}
|
||||||
cmds[i].parent = c
|
x.parent = c
|
||||||
// update max lengths
|
// update max lengths
|
||||||
usageLen := len(x.Use)
|
usageLen := len(x.Use)
|
||||||
if usageLen > c.commandsMaxUseLen {
|
if usageLen > c.commandsMaxUseLen {
|
||||||
|
|
Loading…
Add table
Reference in a new issue