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"
|
"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
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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