Children returns the subcommands of c.
()
| 54 | |
| 55 | // Children returns the subcommands of c. |
| 56 | func (c *Cmd) Children() []*Cmd { |
| 57 | var cmds []*Cmd |
| 58 | for _, cmd := range c.children { |
| 59 | cmds = append(cmds, cmd) |
| 60 | } |
| 61 | sort.Sort(cmdSorter(cmds)) |
| 62 | return cmds |
| 63 | } |
| 64 | |
| 65 | func (c *Cmd) hasSubcommand() bool { |
| 66 | if len(c.children) > 1 { |