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:
commit
d8c9951707
8 changed files with 56 additions and 56 deletions
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewCheckpointCommand appends the `checkpoint` subcommands to rootCmd (only in experimental)
|
// NewCheckpointCommand returns the `checkpoint` subcommand (only in experimental)
|
||||||
func NewCheckpointCommand(rootCmd *cobra.Command, dockerCli *command.DockerCli) {
|
func NewCheckpointCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
|
return &cobra.Command{}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ import (
|
||||||
"github.com/docker/docker/cli/command"
|
"github.com/docker/docker/cli/command"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewCheckpointCommand appends the `checkpoint` subcommands to rootCmd
|
// NewCheckpointCommand returns the `checkpoint` subcommand (only in experimental)
|
||||||
func NewCheckpointCommand(rootCmd *cobra.Command, dockerCli *command.DockerCli) {
|
func NewCheckpointCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "checkpoint",
|
Use: "checkpoint",
|
||||||
Short: "Manage checkpoints",
|
Short: "Manage checkpoints",
|
||||||
|
@ -26,6 +26,5 @@ func NewCheckpointCommand(rootCmd *cobra.Command, dockerCli *command.DockerCli)
|
||||||
newListCommand(dockerCli),
|
newListCommand(dockerCli),
|
||||||
newRemoveCommand(dockerCli),
|
newRemoveCommand(dockerCli),
|
||||||
)
|
)
|
||||||
|
return cmd
|
||||||
rootCmd.AddCommand(cmd)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,9 +71,9 @@ func AddCommands(cmd *cobra.Command, dockerCli *command.DockerCli) {
|
||||||
hide(image.NewSaveCommand(dockerCli)),
|
hide(image.NewSaveCommand(dockerCli)),
|
||||||
hide(image.NewTagCommand(dockerCli)),
|
hide(image.NewTagCommand(dockerCli)),
|
||||||
hide(system.NewInspectCommand(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 {
|
func hide(cmd *cobra.Command) *cobra.Command {
|
||||||
|
|
|
@ -8,5 +8,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewPluginCommand returns a cobra command for `plugin` subcommands
|
// 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{}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewPluginCommand returns a cobra command for `plugin` subcommands
|
// 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{
|
cmd := &cobra.Command{
|
||||||
Use: "plugin",
|
Use: "plugin",
|
||||||
Short: "Manage plugins",
|
Short: "Manage plugins",
|
||||||
|
@ -31,6 +31,5 @@ func NewPluginCommand(rootCmd *cobra.Command, dockerCli *command.DockerCli) {
|
||||||
newSetCommand(dockerCli),
|
newSetCommand(dockerCli),
|
||||||
newPushCommand(dockerCli),
|
newPushCommand(dockerCli),
|
||||||
)
|
)
|
||||||
|
return cmd
|
||||||
rootCmd.AddCommand(cmd)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +1,18 @@
|
||||||
// +build experimental
|
// +build !experimental
|
||||||
|
|
||||||
package stack
|
package stack
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/docker/docker/cli"
|
|
||||||
"github.com/docker/docker/cli/command"
|
"github.com/docker/docker/cli/command"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewStackCommand returns a cobra command for `stack` subcommands
|
// NewStackCommand returns no command
|
||||||
func NewStackCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewStackCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
return &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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTopLevelDeployCommand returns a command for `docker deploy`
|
// NewTopLevelDeployCommand returns no command
|
||||||
func NewTopLevelDeployCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewTopLevelDeployCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
cmd := *newDeployCommand(dockerCli)
|
return &cobra.Command{}
|
||||||
// Remove the aliases at the top level
|
|
||||||
cmd.Aliases = []string{}
|
|
||||||
return &cmd
|
|
||||||
}
|
}
|
||||||
|
|
39
cli/command/stack/cmd_experimental.go
Normal file
39
cli/command/stack/cmd_experimental.go
Normal 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
|
||||||
|
}
|
|
@ -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{}
|
|
||||||
}
|
|
Loading…
Reference in a new issue