From 52b811f50a0906904d688e5fae8f32e1ada90f1a Mon Sep 17 00:00:00 2001 From: Charles Hooper Date: Mon, 11 Mar 2013 23:11:46 +0000 Subject: [PATCH] Add all commands to the output of 'dotcloud help'. Fixes #39 --- server/server.go | 54 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/server/server.go b/server/server.go index 3a66d7e032..37404f2c21 100644 --- a/server/server.go +++ b/server/server.go @@ -37,30 +37,40 @@ func (srv *Server) Name() string { return "docker" } +// FIXME: Stop violating DRY by repeating usage here and in Subcmd declarations func (srv *Server) Help() string { help := "Usage: docker COMMAND [arg...]\n\nA self-sufficient runtime for linux containers.\n\nCommands:\n" for _, cmd := range [][]interface{}{ - {"run", "Run a command in a container"}, - {"ps", "Display a list of containers"}, - {"pull", "Download a tarball and create a container from it"}, - {"put", "Upload a tarball and create a container from it"}, - {"port", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT"}, - {"rm", "Remove containers"}, - {"kill", "Kill a running container"}, - {"wait", "Wait for the state of a container to change"}, - {"stop", "Stop a running container"}, - {"start", "Start a stopped container"}, - {"restart", "Restart a running container"}, - {"logs", "Fetch the logs of a container"}, + {"attach", "Attach to a running container"}, + {"cat", "Write the contents of a container's file to standard output"}, + {"commit", "Create a new image from a container's changes"}, + {"cp", "Create a copy of IMAGE and call it NAME"}, + {"debug", "(debug only) (No documentation available)"}, {"diff", "Inspect changes on a container's filesystem"}, - {"commit", "Save the state of a container"}, - {"attach", "Attach to the standard inputs and outputs of a running container"}, - {"wait", "Block until a container exits, then print its exit code"}, - {"info", "Display system-wide information"}, - {"tar", "Stream the contents of a container as a tar archive"}, - {"web", "Generate a web UI"}, {"images", "List images"}, + {"info", "Display system-wide information"}, {"inspect", "Return low-level information on a container"}, + {"kill", "Kill a running container"}, + {"layers", "(debug only) List filesystem layers"}, + {"logs", "Fetch the logs of a container"}, + {"ls", "List the contents of a container's directory"}, + {"mirror", "(debug only) (No documentation available)"}, + {"port", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT"}, + {"ps", "List containers"}, + {"pull", "Download a new image from a remote location"}, + {"put", "Import a new image from a local archive"}, + {"reset", "Reset changes to a container's filesystem"}, + {"restart", "Restart a running container"}, + {"rm", "Remove a container"}, + {"rmimage", "Remove an image"}, + {"run", "Run a command in a new container"}, + {"start", "Start a stopped container"}, + {"stop", "Stop a running container"}, + {"tar", "Stream the contents of a container as a tar archive"}, + {"umount", "(debug only) Mount a container's filesystem"}, + {"wait", "Block until a container stops, then print its exit code"}, + {"web", "A web UI for docker"}, + {"write", "Write the contents of standard input to a container's file"}, } { help += fmt.Sprintf(" %-10.10s%s\n", cmd...) } @@ -89,6 +99,14 @@ func (srv *Server) CmdWait(stdin io.ReadCloser, stdout io.Writer, args ...string // 'docker info': display system-wide information. func (srv *Server) CmdInfo(stdin io.ReadCloser, stdout io.Writer, args ...string) error { + cmd := rcli.Subcmd(stdout, "info", "", "Display system-wide information.") + if err := cmd.Parse(args); err != nil { + return nil + } + if cmd.NArg() > 1 { + cmd.Usage() + return nil + } fmt.Fprintf(stdout, "containers: %d\nversion: %s\nimages: %d\n", len(srv.containers.List()), VERSION,