mirror of
https://github.com/spf13/cobra
synced 2025-05-06 05:17:21 +00:00
Check if root cmd is runnable and run if it is
This commit is contained in:
parent
3745fcd262
commit
9fc0d920d7
1 changed files with 4 additions and 1 deletions
|
@ -892,7 +892,10 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
|
|||
}
|
||||
|
||||
var flags []string
|
||||
if c.TraverseChildren {
|
||||
if c.Runnable() {
|
||||
cmd = c
|
||||
flags = args
|
||||
} else if c.TraverseChildren {
|
||||
cmd, flags, err = c.Traverse(args)
|
||||
} else {
|
||||
cmd, flags, err = c.Find(args)
|
||||
|
|
Loading…
Add table
Reference in a new issue