From ad83c422f25498afda0c9a45741dff76e5ae8a3d Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 19 Apr 2016 12:59:48 -0400 Subject: [PATCH] Migrate volume commands to cobra. Signed-off-by: Daniel Nephin --- docker.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker.go b/docker.go index 8397124932..45de2e3fca 100644 --- a/docker.go +++ b/docker.go @@ -8,6 +8,7 @@ import ( "github.com/Sirupsen/logrus" "github.com/docker/docker/api/client" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/cobraadaptor" cliflags "github.com/docker/docker/cli/flags" "github.com/docker/docker/cliconfig" "github.com/docker/docker/dockerversion" @@ -31,6 +32,8 @@ func main() { flag.Merge(flag.CommandLine, clientFlags.FlagSet, commonFlags.FlagSet) + cobraAdaptor := cobraadaptor.NewCobraAdaptor(clientFlags) + flag.Usage = func() { fmt.Fprint(stdout, "Usage: docker [OPTIONS] COMMAND [arg...]\n docker [ --help | -v | --version ]\n\n") fmt.Fprint(stdout, "A self-sufficient runtime for containers.\n\nOptions:\n") @@ -40,8 +43,8 @@ func main() { help := "\nCommands:\n" - dockerCommands := sortCommands(cli.DockerCommandUsage) - for _, cmd := range dockerCommands { + dockerCommands := append(cli.DockerCommandUsage, cobraAdaptor.Usage()...) + for _, cmd := range sortCommands(dockerCommands) { help += fmt.Sprintf(" %-10.10s%s\n", cmd.Name, cmd.Description) } @@ -65,7 +68,7 @@ func main() { clientCli := client.NewDockerCli(stdin, stdout, stderr, clientFlags) - c := cli.New(clientCli, NewDaemonProxy()) + c := cli.New(clientCli, NewDaemonProxy(), cobraAdaptor) if err := c.Run(flag.Args()...); err != nil { if sterr, ok := err.(cli.StatusError); ok { if sterr.Status != "" {