From 298a26e0b2d086a32f14ee675bf24322cc92ddd4 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 19 May 2018 03:20:27 +0200 Subject: [PATCH] Remove unused help command dockerd has no subcommands, so the help command is not used. Signed-off-by: Sebastiaan van Stijn --- cli/cobra.go | 20 -------------------- 1 file changed, 20 deletions(-) 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 }