mirror of https://github.com/docker/cli.git
Merge pull request #23309 from yongtang/23211-spf13-cobra-commit
Use spf13/cobra for docker commit
This commit is contained in:
commit
fdc52d0f51
|
@ -36,6 +36,7 @@ func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor {
|
||||||
rootCmd.SetOutput(stdout)
|
rootCmd.SetOutput(stdout)
|
||||||
rootCmd.AddCommand(
|
rootCmd.AddCommand(
|
||||||
container.NewAttachCommand(dockerCli),
|
container.NewAttachCommand(dockerCli),
|
||||||
|
container.NewCommitCommand(dockerCli),
|
||||||
container.NewCreateCommand(dockerCli),
|
container.NewCreateCommand(dockerCli),
|
||||||
container.NewDiffCommand(dockerCli),
|
container.NewDiffCommand(dockerCli),
|
||||||
container.NewExportCommand(dockerCli),
|
container.NewExportCommand(dockerCli),
|
||||||
|
|
|
@ -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
|
// RequiresRangeArgs returns an error if there is not at least min args and at most max args
|
||||||
func RequiresMinMaxArgs(min int, max int) cobra.PositionalArgs {
|
func RequiresRangeArgs(min int, max int) cobra.PositionalArgs {
|
||||||
return func(cmd *cobra.Command, args []string) error {
|
return func(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) >= min && len(args) <= max {
|
if len(args) >= min && len(args) <= max {
|
||||||
return nil
|
return nil
|
||||||
|
|
1
usage.go
1
usage.go
|
@ -8,7 +8,6 @@ type Command struct {
|
||||||
|
|
||||||
// DockerCommandUsage lists the top level docker commands and their short usage
|
// DockerCommandUsage lists the top level docker commands and their short usage
|
||||||
var DockerCommandUsage = []Command{
|
var DockerCommandUsage = []Command{
|
||||||
{"commit", "Create a new image from a container's changes"},
|
|
||||||
{"cp", "Copy files/folders between a container and the local filesystem"},
|
{"cp", "Copy files/folders between a container and the local filesystem"},
|
||||||
{"exec", "Run a command in a running container"},
|
{"exec", "Run a command in a running container"},
|
||||||
{"info", "Display system-wide information"},
|
{"info", "Display system-wide information"},
|
||||||
|
|
Loading…
Reference in New Issue