mirror of https://github.com/docker/cli.git
Make all the experimental subcommand consistent.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
1f0f7ecb5a
commit
3e1b9350f5
|
@ -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{}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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{}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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{}
|
||||
}
|
||||
|
|
|
@ -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 New Issue