From 43fdd6f2fa3dc514bf53338c375af2710c5b971f Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Mon, 6 Jun 2016 07:57:44 -0700 Subject: [PATCH] Use spf13/cobra for docker commit This fix is part of the effort to convert commands to spf13/cobra #23211. Thif fix coverted command `docker commit` to use spf13/cobra NOTE: `RequiresMinMaxArgs()` has been renamed to `RequiresRangeArgs()`. Signed-off-by: Yong Tang --- cobraadaptor/adaptor.go | 1 + required.go | 4 ++-- usage.go | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cobraadaptor/adaptor.go b/cobraadaptor/adaptor.go index 11b821cc44..4d4ca433ba 100644 --- a/cobraadaptor/adaptor.go +++ b/cobraadaptor/adaptor.go @@ -36,6 +36,7 @@ func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor { rootCmd.SetOutput(stdout) rootCmd.AddCommand( container.NewAttachCommand(dockerCli), + container.NewCommitCommand(dockerCli), container.NewCreateCommand(dockerCli), container.NewDiffCommand(dockerCli), container.NewExportCommand(dockerCli), diff --git a/required.go b/required.go index 0c08e64f1a..9276a5740a 100644 --- a/required.go +++ b/required.go @@ -60,8 +60,8 @@ func RequiresMaxArgs(max int) cobra.PositionalArgs { } } -// RequiresMinMaxArgs returns an error if there is not at least min args and at most max args -func RequiresMinMaxArgs(min int, max int) cobra.PositionalArgs { +// RequiresRangeArgs returns an error if there is not at least min args and at most max args +func RequiresRangeArgs(min int, max int) cobra.PositionalArgs { return func(cmd *cobra.Command, args []string) error { if len(args) >= min && len(args) <= max { return nil diff --git a/usage.go b/usage.go index e9debf3be7..32b3442653 100644 --- a/usage.go +++ b/usage.go @@ -8,7 +8,6 @@ type Command struct { // DockerCommandUsage lists the top level docker commands and their short usage var DockerCommandUsage = []Command{ - {"commit", "Create a new image from a container's changes"}, {"cp", "Copy files/folders between a container and the local filesystem"}, {"exec", "Run a command in a running container"}, {"info", "Display system-wide information"},