From 330e026bfbadbde9cdb4874e78bcfe54cccf137b Mon Sep 17 00:00:00 2001 From: Lei Xue Date: Mon, 17 Apr 2017 22:03:10 +0800 Subject: [PATCH] commit sub-command --- api/client/commit.go | 11 +++++------ cli/common.go | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/api/client/commit.go b/api/client/commit.go index b339b3a69..6e2cfa32e 100644 --- a/api/client/commit.go +++ b/api/client/commit.go @@ -4,27 +4,26 @@ import ( "encoding/json" "fmt" - "golang.org/x/net/context" - "github.com/docker/engine-api/types" "github.com/docker/engine-api/types/container" Cli "github.com/hyperhq/hypercli/cli" "github.com/hyperhq/hypercli/opts" flag "github.com/hyperhq/hypercli/pkg/mflag" + "golang.org/x/net/context" ) // CmdCommit creates a new image from a container's changes. // -// Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] -func (cli *DockerCli) Commit(args ...string) error { +// Usage: hyper commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] +func (cli *DockerCli) CmdCommit(args ...string) error { cmd := Cli.Subcmd("commit", []string{"CONTAINER [REPOSITORY[:TAG]]"}, Cli.DockerCommands["commit"].Description, true) - flPause := cmd.Bool([]string{"p", "-pause"}, true, "Pause container during commit") + flPause := cmd.Bool([]string{}, true, "Pause container during commit") flComment := cmd.String([]string{"m", "-message"}, "", "Commit message") flAuthor := cmd.String([]string{"a", "-author"}, "", "Author (e.g., \"John Hannibal Smith \")") flChanges := opts.NewListOpts(nil) cmd.Var(&flChanges, []string{"c", "-change"}, "Apply Dockerfile instruction to the created image") // FIXME: --run is deprecated, it will be replaced with inline Dockerfile commands. - flConfig := cmd.String([]string{"#-run"}, "", "This option is deprecated and will be removed in a future version in favor of inline Dockerfile-compatible commands") + flConfig := cmd.String([]string{}, "", "This option is deprecated and will be removed in a future version in favor of inline Dockerfile-compatible commands") cmd.Require(flag.Max, 2) cmd.Require(flag.Min, 1) diff --git a/cli/common.go b/cli/common.go index ecdcefdda..08f5ac60a 100644 --- a/cli/common.go +++ b/cli/common.go @@ -28,7 +28,7 @@ type Command struct { var dockerCommands = []Command{ {"attach", "Attach to a running container"}, //{"build", "Build an image from a Dockerfile"}, - //{"commit", "Create a new image from a container's changes"}, + {"commit", "Create a new image from a container's changes"}, {"config", "Config access key and secret key to Hyper server"}, //{"cp", "Copy files/folders between a container and the local filesystem"}, {"create", "Create a new container"},