Skip to content
Myr

Remove specail casing in Execute()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

We had some stuff that created a new empty []string if args was already and empty string (why?) We had some stuff that called Help() if it wasn't runnable (but .execute() already does that) Just remove the special case stuff.

authored by Eric Paris · committed by Eric Paris · parent b9e25fa · Browse files · 1 file+3 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−14 removed

  • other:+3 added−14 removed

1 file+3 added−14 removed

modified:command.go+3 added-14 removed
474 unmodified lines
475 } else {476 args = c.args477 }478479 if len(args) == 0 {480 // Only the executable is called and the root is runnable, run it481 if c.Runnable() {482 err = c.execute([]string(nil))483 } else {484 c.Help()485 }486 } else {487 cmd, flags, e := c.Find(args)488 if e != nil {489 err = e479 cmd, flags, err := c.Find(args)480 if err == nil {481 err = cmd.execute(flags)490 } else {491 err = cmd.execute(flags)492 }482 }483484 if err != nil {485 if err == flag.ErrHelp {
418 unmodified lines