Skip to content
Myr

Merge pull request #85 from eparis/more-simplification

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

More simplification

authored by Eric Paris · committed by Eric Paris · parents 2d5fab0, 794a362 · Browse files · 1 file+13 added−25 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+13 added−25 removed

  • other:+13 added−25 removed

1 file+13 added−25 removed

modified:command.go+13 added-25 removed
430 unmodified lines
431 r.SetOutput(r.cmdErrorBuf)432 c.Usage()433 r.SetOutput(out)434 return err435 } else {436 // If help is called, regardless of other flags, we print that.437 // Print help also if c.Run is nil.438 if c.helpFlagVal || !c.Runnable() {439 c.Help()440 return nil441 }442443 c.preRun()444 argWoFlags := c.Flags().Args()445 c.Run(c, argWoFlags)435 }436 // If help is called, regardless of other flags, we print that.437 // Print help also if c.Run is nil.438 if c.helpFlagVal || !c.Runnable() {439 c.Help()440 return nil441 }442443 c.preRun()444 argWoFlags := c.Flags().Args()445 c.Run(c, argWoFlags)446 return nil447}448449func (c *Command) preRun() {450 for _, x := range initializers {
42 unmodified lines
493 } else {494 args = c.args495 }496498 if len(args) == 0 {499 // Only the executable is called and the root is runnable, run it500 if c.Runnable() {501 err = c.execute([]string(nil))502 } else {503 c.Help()504 }505 } else {506 cmd, flags, e := c.Find(args)507 if e != nil {508 err = e497 cmd, flags, err := c.Find(args)498 if err == nil {499 err = cmd.execute(flags)509 } else {510 err = cmd.execute(flags)511 }500 }501502 if err != nil {503 if err == flag.ErrHelp {
456 unmodified lines