github.com/guilhermebr/docker@v1.4.2-0.20150428121140-67da055cebca/api/client/help.go (about) 1 package client 2 3 import ( 4 "fmt" 5 "os" 6 7 flag "github.com/docker/docker/pkg/mflag" 8 ) 9 10 // CmdHelp displays information on a Docker command. 11 // 12 // If more than one command is specified, information is only shown for the first command. 13 // 14 // Usage: docker help COMMAND or docker COMMAND --help 15 func (cli *DockerCli) CmdHelp(args ...string) error { 16 if len(args) > 1 { 17 method, exists := cli.getMethod(args[:2]...) 18 if exists { 19 method("--help") 20 return nil 21 } 22 } 23 if len(args) > 0 { 24 method, exists := cli.getMethod(args[0]) 25 if !exists { 26 fmt.Fprintf(cli.err, "docker: '%s' is not a docker command. See 'docker --help'.\n", args[0]) 27 os.Exit(1) 28 } else { 29 method("--help") 30 return nil 31 } 32 } 33 34 flag.Usage() 35 36 return nil 37 }