Skip to content

Commit 708ed9d

Browse files
committed
Merge pull request moby#11766 from peggyl/11596-api-commands-godoc
Add godoc-style docstrings to Cmd... methods
2 parents a196cc9 + 2a5a402 commit 708ed9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+152
-8
lines changed

api/client/attach.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import (
1212
"github.com/docker/docker/utils"
1313
)
1414

15+
// CmdAttach attaches to a running container.
16+
//
17+
// Usage: docker attach [OPTIONS] CONTAINER
1518
func (cli *DockerCli) CmdAttach(args ...string) error {
1619
var (
1720
cmd = cli.Subcmd("attach", "CONTAINER", "Attach to a running container", true)

api/client/build.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ const (
3838
tarHeaderSize = 512
3939
)
4040

41+
// CmdBuild builds a new image from the source code at a given path.
42+
//
43+
// If '-' is provided instead of a path or URL, Docker will build an image from either a Dockerfile or tar archive read from STDIN.
44+
//
45+
// Usage: docker build [OPTIONS] PATH | URL | -
4146
func (cli *DockerCli) CmdBuild(args ...string) error {
4247
cmd := cli.Subcmd("build", "PATH | URL | -", "Build a new image from the source code at PATH", true)
4348
tag := cmd.String([]string{"t", "-tag"}, "", "Repository name (and optionally a tag) for the image")

api/client/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (cli *DockerCli) getMethod(args ...string) (func(...string) error, bool) {
6464
return method.Interface().(func(...string) error), true
6565
}
6666

67-
// Cmd executes the specified command
67+
// Cmd executes the specified command.
6868
func (cli *DockerCli) Cmd(args ...string) error {
6969
if len(args) > 1 {
7070
method, exists := cli.getMethod(args[:2]...)

api/client/client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Package client provides a command-line interface for Docker.
2+
//
3+
// Run "docker help SUBCOMMAND" or "docker SUBCOMMAND --help" to see more information on any Docker subcommand, including the full list of options supported for the subcommand.
4+
// See https://docs.docker.com/installation/ for instructions on installing Docker.
5+
package client

api/client/commit.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import (
1414
"github.com/docker/docker/utils"
1515
)
1616

17+
// CmdCommit creates a new image from a container's changes.
18+
//
19+
// Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
1720
func (cli *DockerCli) CmdCommit(args ...string) error {
1821
cmd := cli.Subcmd("commit", "CONTAINER [REPOSITORY[:TAG]]", "Create a new image from a container's changes", true)
1922
flPause := cmd.Bool([]string{"p", "-pause"}, true, "Pause container during commit")

api/client/cp.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import (
1111
"github.com/docker/docker/utils"
1212
)
1313

14+
// CmdCp copies files/folders from a path on the container to a directory on the host running the command.
15+
//
16+
// If HOSTDIR is '-', the data is written as a tar file to STDOUT.
17+
//
18+
// Usage: docker cp CONTAINER:PATH HOSTDIR
1419
func (cli *DockerCli) CmdCp(args ...string) error {
1520
cmd := cli.Subcmd("cp", "CONTAINER:PATH HOSTDIR|-", "Copy files/folders from a PATH on the container to a HOSTDIR on the host\nrunning the command. Use '-' to write the data\nas a tar file to STDOUT.", true)
1621
cmd.Require(flag.Exact, 2)

api/client/create.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ func (cli *DockerCli) createContainer(config *runconfig.Config, hostConfig *runc
128128
return &response, nil
129129
}
130130

131+
// CmdCreate creates a new container from a given image.
132+
//
133+
// Usage: docker create [OPTIONS] IMAGE [COMMAND] [ARG...]
131134
func (cli *DockerCli) CmdCreate(args ...string) error {
132135
cmd := cli.Subcmd("create", "IMAGE [COMMAND] [ARG...]", "Create a new container", true)
133136

api/client/diff.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ import (
99
"github.com/docker/docker/utils"
1010
)
1111

12+
// CmdDiff shows changes on a container's filesystem.
13+
//
14+
// Each changed file is printed on a separate line, prefixed with a single character that indicates the status of the file: C (modified), A (added), or D (deleted).
15+
//
16+
// Usage: docker diff CONTAINER
1217
func (cli *DockerCli) CmdDiff(args ...string) error {
1318
cmd := cli.Subcmd("diff", "CONTAINER", "Inspect changes on a container's filesystem", true)
1419
cmd.Require(flag.Exact, 1)

api/client/events.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import (
1212
"github.com/docker/docker/utils"
1313
)
1414

15+
// CmdEvents prints a live stream of real time events from the server.
16+
//
17+
// Usage: docker events [OPTIONS]
1518
func (cli *DockerCli) CmdEvents(args ...string) error {
1619
cmd := cli.Subcmd("events", "", "Get real time events from the server", true)
1720
since := cmd.String([]string{"#since", "-since"}, "", "Show all events created since timestamp")

api/client/exec.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import (
1212
"github.com/docker/docker/utils"
1313
)
1414

15+
// CmdExec runs a command in a running container.
16+
//
17+
// Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
1518
func (cli *DockerCli) CmdExec(args ...string) error {
1619
cmd := cli.Subcmd("exec", "CONTAINER COMMAND [ARG...]", "Run a command in a running container", true)
1720

0 commit comments

Comments
 (0)