mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
CLI: implemented 'docker help COMMAND'
This commit is contained in:
parent
12599e1c55
commit
8aa2cb7d84
1 changed files with 25 additions and 16 deletions
|
@ -21,14 +21,16 @@ import (
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (docker *Docker) CmdUsage(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
|
func (docker *Docker) CmdHelp(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
|
||||||
fmt.Fprintf(stdout, "Usage: docker COMMAND [arg...]\n\nCommands:\n")
|
log.Printf("Help %s\n", args)
|
||||||
|
if len(args) == 0 {
|
||||||
|
fmt.Fprintf(stdout, "Usage: docker COMMAND [arg...]\n\nA self-sufficient runtime for linux containers.\n\nCommands:\n")
|
||||||
for _, cmd := range [][]interface{}{
|
for _, cmd := range [][]interface{}{
|
||||||
{"run", "Run a command in a container"},
|
{"run", "Run a command in a container"},
|
||||||
|
{"clone", "Duplicate a container"},
|
||||||
{"list", "Display a list of containers"},
|
{"list", "Display a list of containers"},
|
||||||
{"layers", "Display a list of layers"},
|
{"layers", "Display a list of layers"},
|
||||||
{"download", "Download a layer from a remote location"},
|
{"get", "Download a layer from a remote location"},
|
||||||
{"upload", "Upload a layer"},
|
|
||||||
{"wait", "Wait for the state of a container to change"},
|
{"wait", "Wait for the state of a container to change"},
|
||||||
{"stop", "Stop a running container"},
|
{"stop", "Stop a running container"},
|
||||||
{"logs", "Fetch the logs of a container"},
|
{"logs", "Fetch the logs of a container"},
|
||||||
|
@ -38,6 +40,13 @@ func (docker *Docker) CmdUsage(stdin io.ReadCloser, stdout io.Writer, args ...st
|
||||||
} {
|
} {
|
||||||
fmt.Fprintf(stdout, " %-10.10s%s\n", cmd...)
|
fmt.Fprintf(stdout, " %-10.10s%s\n", cmd...)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if method := docker.getMethod(args[0]); method == nil {
|
||||||
|
return errors.New("No such command: " + args[0])
|
||||||
|
} else {
|
||||||
|
method(stdin, stdout, "--help")
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue