diff --git a/cobra_test.go b/cobra_test.go index e6551e0..001c825 100644 --- a/cobra_test.go +++ b/cobra_test.go @@ -201,7 +201,7 @@ func TestChildCommandFlags(t *testing.T) { t.Errorf("invalid flag should generate error") } - if !strings.Contains(buf.String(), "inttwo=234") { + if !strings.Contains(buf.String(), "unknown shorthand") { t.Errorf("Wrong error message displayed, \n %s", buf.String()) } diff --git a/command.go b/command.go index ce4557d..b8e4781 100644 --- a/command.go +++ b/command.go @@ -149,12 +149,6 @@ func (c *Command) execute(args []string) (err error) { if e == nil { err = cmd.ParseFlags(a) if err != nil { - // report flag parsing error - c.Println(strings.Split(err.Error(), "\n")[0]) - erx := cmd.Usage() - if erx != nil { - return erx - } return err } else { argWoFlags := cmd.Flags().Args()