diff --git a/cli/cobra.go b/cli/cobra.go index f6a69ae070..feab2b4a91 100644 --- a/cli/cobra.go +++ b/cli/cobra.go @@ -92,12 +92,8 @@ func FlagErrorFunc(cmd *cobra.Command, err error) error { return nil } - usage := "" - if cmd.HasSubCommands() { - usage = "\n\n" + cmd.UsageString() - } return StatusError{ - Status: fmt.Sprintf("%s\nSee '%s --help'.%s", err, cmd.CommandPath(), usage), + Status: fmt.Sprintf("%s\n\nUsage: %s\n\nRun '%s --help' for more information", err, cmd.UseLine(), cmd.CommandPath()), StatusCode: 125, } } diff --git a/e2e/cli-plugins/help_test.go b/e2e/cli-plugins/help_test.go index 85db703d30..a686b9ac45 100644 --- a/e2e/cli-plugins/help_test.go +++ b/e2e/cli-plugins/help_test.go @@ -78,6 +78,6 @@ func TestGlobalHelp(t *testing.T) { }) assert.Assert(t, is.Equal(res2.Stdout(), "")) assert.Assert(t, is.Contains(res2.Stderr(), "unknown flag: --badopt")) - assert.Assert(t, is.Contains(res2.Stderr(), "See 'docker --help")) + assert.Assert(t, is.Contains(res2.Stderr(), "Run 'docker --help' for more information")) }) }