diff --git a/cli/cobra.go b/cli/cobra.go index 30854a0092..7c4196e141 100644 --- a/cli/cobra.go +++ b/cli/cobra.go @@ -2,10 +2,8 @@ package cli // import "github.com/docker/docker/cli" import ( "fmt" - "strings" "github.com/docker/docker/pkg/term" - "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -21,7 +19,6 @@ func SetupRootCommand(rootCmd *cobra.Command) { rootCmd.SetUsageTemplate(usageTemplate) rootCmd.SetHelpTemplate(helpTemplate) rootCmd.SetFlagErrorFunc(FlagErrorFunc) - rootCmd.SetHelpCommand(helpCommand) rootCmd.SetVersionTemplate("Docker version {{.Version}}\n") rootCmd.PersistentFlags().BoolP("help", "h", false, "Print usage") @@ -45,23 +42,6 @@ func FlagErrorFunc(cmd *cobra.Command, err error) error { } } -var helpCommand = &cobra.Command{ - Use: "help [command]", - Short: "Help about the command", - PersistentPreRun: func(cmd *cobra.Command, args []string) {}, - PersistentPostRun: func(cmd *cobra.Command, args []string) {}, - RunE: func(c *cobra.Command, args []string) error { - cmd, args, e := c.Root().Find(args) - if cmd == nil || e != nil || len(args) > 0 { - return errors.Errorf("unknown help topic: %v", strings.Join(args, " ")) - } - - helpFunc := cmd.HelpFunc() - helpFunc(cmd, args) - return nil - }, -} - func hasSubCommands(cmd *cobra.Command) bool { return len(operationSubCommands(cmd)) > 0 }