Skip to content

Commit

Permalink
Fix Run with multiple levels of subcommands. (#5)
Browse files Browse the repository at this point in the history
Without this, a non-executable subcommand of a non-executable command
will incorrectly report not being understood.

Signed-off-by: David Anderson <[email protected]>
  • Loading branch information
danderson authored Jan 27, 2025
1 parent b5768f3 commit ce857d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion command.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (c *C) Runnable() bool { return c != nil && (c.Run != nil || c.Init != nil)
func (c *C) HasRunnableSubcommands() bool {
if c != nil {
for _, cmd := range c.Commands {
if cmd.Runnable() {
if cmd.Runnable() || cmd.HasRunnableSubcommands() {
return true
}
}
Expand Down

0 comments on commit ce857d5

Please sign in to comment.