mirror of
https://github.com/docker/cli.git
synced 2026-01-13 18:22:35 +03:00
Unexport swarm commands
This patch deprecates exported swarm commands and moves the implementation details to an unexported function. Commands that are affected include: - swarm.NewSwarmCommand Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
This commit is contained in:
@@ -89,6 +89,7 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) {
|
||||
service.NewServiceCommand(dockerCli),
|
||||
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
|
||||
stack.NewStackCommand(dockerCli),
|
||||
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
|
||||
swarm.NewSwarmCommand(dockerCli),
|
||||
|
||||
// legacy commands may be hidden
|
||||
|
||||
@@ -8,26 +8,33 @@ import (
|
||||
)
|
||||
|
||||
// NewSwarmCommand returns a cobra command for `swarm` subcommands
|
||||
func NewSwarmCommand(dockerCli command.Cli) *cobra.Command {
|
||||
//
|
||||
// Deprecated: Do not import commands directly. They will be removed in a future release.
|
||||
func NewSwarmCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
return newSwarmCommand(dockerCLI)
|
||||
}
|
||||
|
||||
// newSwarmCommand returns a cobra command for `swarm` subcommands
|
||||
func newSwarmCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "swarm",
|
||||
Short: "Manage Swarm",
|
||||
Args: cli.NoArgs,
|
||||
RunE: command.ShowHelp(dockerCli.Err()),
|
||||
RunE: command.ShowHelp(dockerCLI.Err()),
|
||||
Annotations: map[string]string{
|
||||
"version": "1.24",
|
||||
"swarm": "", // swarm command itself does not require swarm to be enabled (so swarm init and join is always available on API 1.24 and up)
|
||||
},
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newInitCommand(dockerCli),
|
||||
newJoinCommand(dockerCli),
|
||||
newJoinTokenCommand(dockerCli),
|
||||
newUnlockKeyCommand(dockerCli),
|
||||
newUpdateCommand(dockerCli),
|
||||
newLeaveCommand(dockerCli),
|
||||
newUnlockCommand(dockerCli),
|
||||
newCACommand(dockerCli),
|
||||
newInitCommand(dockerCLI),
|
||||
newJoinCommand(dockerCLI),
|
||||
newJoinTokenCommand(dockerCLI),
|
||||
newUnlockKeyCommand(dockerCLI),
|
||||
newUpdateCommand(dockerCLI),
|
||||
newLeaveCommand(dockerCLI),
|
||||
newUnlockCommand(dockerCLI),
|
||||
newCACommand(dockerCLI),
|
||||
)
|
||||
return cmd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user