2015-03-25 03:57:23 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
flag "github.com/docker/docker/pkg/mflag"
|
|
|
|
)
|
|
|
|
|
2015-03-25 17:34:41 +00:00
|
|
|
// CmdHelp displays information on a Docker command.
|
|
|
|
//
|
2015-03-25 23:26:28 +00:00
|
|
|
// If more than one command is specified, information is only shown for the first command.
|
2015-03-25 17:34:41 +00:00
|
|
|
//
|
|
|
|
// Usage: docker help COMMAND or docker COMMAND --help
|
2015-03-25 03:57:23 +00:00
|
|
|
func (cli *DockerCli) CmdHelp(args ...string) error {
|
|
|
|
if len(args) > 1 {
|
|
|
|
method, exists := cli.getMethod(args[:2]...)
|
|
|
|
if exists {
|
|
|
|
method("--help")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(args) > 0 {
|
|
|
|
method, exists := cli.getMethod(args[0])
|
|
|
|
if !exists {
|
2015-05-05 07:59:17 +00:00
|
|
|
return fmt.Errorf("docker: '%s' is not a docker command. See 'docker --help'.", args[0])
|
2015-03-25 03:57:23 +00:00
|
|
|
}
|
2015-05-19 02:54:04 +00:00
|
|
|
method("--help")
|
|
|
|
return nil
|
2015-03-25 03:57:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
flag.Usage()
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|