浏览代码

Remove unused help command

dockerd has no subcommands, so the help command
is not used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 7 年之前
父节点
当前提交
298a26e0b2
共有 1 个文件被更改,包括 0 次插入20 次删除
  1. 0 20
      cli/cobra.go

+ 0 - 20
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
 }