1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #26717 from dnephin/fix_experimental_commands

Make all the experimental subcommand consistent
This commit is contained in:
Daniel Nephin 2016-09-19 19:29:48 -04:00 committed by GitHub
commit d8c9951707
8 changed files with 56 additions and 56 deletions

View file

@ -7,6 +7,7 @@ import (
"github.com/spf13/cobra"
)
// NewCheckpointCommand appends the `checkpoint` subcommands to rootCmd (only in experimental)
func NewCheckpointCommand(rootCmd *cobra.Command, dockerCli *command.DockerCli) {
// NewCheckpointCommand returns the `checkpoint` subcommand (only in experimental)
func NewCheckpointCommand(dockerCli *command.DockerCli) *cobra.Command {
return &cobra.Command{}
}

View file

@ -11,8 +11,8 @@ import (
"github.com/docker/docker/cli/command"
)
// NewCheckpointCommand appends the `checkpoint` subcommands to rootCmd
func NewCheckpointCommand(rootCmd *cobra.Command, dockerCli *command.DockerCli) {
// NewCheckpointCommand returns the `checkpoint` subcommand (only in experimental)
func NewCheckpointCommand(dockerCli *command.DockerCli) *cobra.Command {
cmd := &cobra.Command{
Use: "checkpoint",
Short: "Manage checkpoints",
@ -26,6 +26,5 @@ func NewCheckpointCommand(rootCmd *cobra.Command, dockerCli *command.DockerCli)
newListCommand(dockerCli),
newRemoveCommand(dockerCli),
)
rootCmd.AddCommand(cmd)
return cmd
}

View file

@ -71,9 +71,9 @@ func AddCommands(cmd *cobra.Command, dockerCli *command.DockerCli) {
hide(image.NewSaveCommand(dockerCli)),
hide(image.NewTagCommand(dockerCli)),
hide(system.NewInspectCommand(dockerCli)),
checkpoint.NewCheckpointCommand(dockerCli),
plugin.NewPluginCommand(dockerCli),
)
checkpoint.NewCheckpointCommand(cmd, dockerCli)
plugin.NewPluginCommand(cmd, dockerCli)
}
func hide(cmd *cobra.Command) *cobra.Command {

View file

@ -8,5 +8,6 @@ import (
)
// NewPluginCommand returns a cobra command for `plugin` subcommands
func NewPluginCommand(cmd *cobra.Command, dockerCli *command.DockerCli) {
func NewPluginCommand(dockerCli *command.DockerCli) *cobra.Command {
return &cobra.Command{}
}

View file

@ -11,7 +11,7 @@ import (
)
// NewPluginCommand returns a cobra command for `plugin` subcommands
func NewPluginCommand(rootCmd *cobra.Command, dockerCli *command.DockerCli) {
func NewPluginCommand(dockerCli *command.DockerCli) *cobra.Command {
cmd := &cobra.Command{
Use: "plugin",
Short: "Manage plugins",
@ -31,6 +31,5 @@ func NewPluginCommand(rootCmd *cobra.Command, dockerCli *command.DockerCli) {
newSetCommand(dockerCli),
newPushCommand(dockerCli),
)
rootCmd.AddCommand(cmd)
return cmd
}

View file

@ -1,39 +1,18 @@
// +build experimental
// +build !experimental
package stack
import (
"fmt"
"github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/spf13/cobra"
)
// NewStackCommand returns a cobra command for `stack` subcommands
// NewStackCommand returns no command
func NewStackCommand(dockerCli *command.DockerCli) *cobra.Command {
cmd := &cobra.Command{
Use: "stack",
Short: "Manage stacks",
Args: cli.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
fmt.Fprintf(dockerCli.Err(), "\n"+cmd.UsageString())
},
}
cmd.AddCommand(
newConfigCommand(dockerCli),
newDeployCommand(dockerCli),
newRemoveCommand(dockerCli),
newServicesCommand(dockerCli),
newPsCommand(dockerCli),
)
return cmd
return &cobra.Command{}
}
// NewTopLevelDeployCommand returns a command for `docker deploy`
// NewTopLevelDeployCommand returns no command
func NewTopLevelDeployCommand(dockerCli *command.DockerCli) *cobra.Command {
cmd := *newDeployCommand(dockerCli)
// Remove the aliases at the top level
cmd.Aliases = []string{}
return &cmd
return &cobra.Command{}
}

View file

@ -0,0 +1,39 @@
// +build experimental
package stack
import (
"fmt"
"github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/spf13/cobra"
)
// NewStackCommand returns a cobra command for `stack` subcommands
func NewStackCommand(dockerCli *command.DockerCli) *cobra.Command {
cmd := &cobra.Command{
Use: "stack",
Short: "Manage Docker stacks",
Args: cli.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
fmt.Fprintf(dockerCli.Err(), "\n"+cmd.UsageString())
},
}
cmd.AddCommand(
newConfigCommand(dockerCli),
newDeployCommand(dockerCli),
newRemoveCommand(dockerCli),
newServicesCommand(dockerCli),
newPsCommand(dockerCli),
)
return cmd
}
// NewTopLevelDeployCommand returns a command for `docker deploy`
func NewTopLevelDeployCommand(dockerCli *command.DockerCli) *cobra.Command {
cmd := newDeployCommand(dockerCli)
// Remove the aliases at the top level
cmd.Aliases = []string{}
return cmd
}

View file

@ -1,18 +0,0 @@
// +build !experimental
package stack
import (
"github.com/docker/docker/cli/command"
"github.com/spf13/cobra"
)
// NewStackCommand returns no command
func NewStackCommand(dockerCli *command.DockerCli) *cobra.Command {
return &cobra.Command{}
}
// NewTopLevelDeployCommand returns no command
func NewTopLevelDeployCommand(dockerCli *command.DockerCli) *cobra.Command {
return &cobra.Command{}
}