Skip to content

Commit 01ea3a7

Browse files
BenehikothaJeztah
authored andcommitted
Unexport service commands
This patch deprecates exported service commands and moves the implementation details to an unexported function. Commands that are affected include: - service.NewServiceCommand Signed-off-by: Alano Terblanche <[email protected]> (cherry picked from commit 88178ed) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 0f2721e commit 01ea3a7

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

cli/command/commands/commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) {
8080
node.NewNodeCommand(dockerCli),
8181
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
8282
secret.NewSecretCommand(dockerCli),
83+
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
8384
service.NewServiceCommand(dockerCli),
8485
stack.NewStackCommand(dockerCli),
8586
swarm.NewSwarmCommand(dockerCli),

cli/command/service/cmd.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,34 @@ import (
77
)
88

99
// NewServiceCommand returns a cobra command for `service` subcommands
10-
func NewServiceCommand(dockerCli command.Cli) *cobra.Command {
10+
//
11+
// Deprecated: Do not import commands directly. They will be removed in a future release.
12+
func NewServiceCommand(dockerCLI command.Cli) *cobra.Command {
13+
return newServiceCommand(dockerCLI)
14+
}
15+
16+
// newServiceCommand returns a cobra command for `service` subcommands
17+
func newServiceCommand(dockerCLI command.Cli) *cobra.Command {
1118
cmd := &cobra.Command{
1219
Use: "service",
1320
Short: "Manage Swarm services",
1421
Args: cli.NoArgs,
15-
RunE: command.ShowHelp(dockerCli.Err()),
22+
RunE: command.ShowHelp(dockerCLI.Err()),
1623
Annotations: map[string]string{
1724
"version": "1.24",
1825
"swarm": "manager",
1926
},
2027
}
2128
cmd.AddCommand(
22-
newCreateCommand(dockerCli),
23-
newInspectCommand(dockerCli),
24-
newPsCommand(dockerCli),
25-
newListCommand(dockerCli),
26-
newRemoveCommand(dockerCli),
27-
newScaleCommand(dockerCli),
28-
newUpdateCommand(dockerCli),
29-
newLogsCommand(dockerCli),
30-
newRollbackCommand(dockerCli),
29+
newCreateCommand(dockerCLI),
30+
newInspectCommand(dockerCLI),
31+
newPsCommand(dockerCLI),
32+
newListCommand(dockerCLI),
33+
newRemoveCommand(dockerCLI),
34+
newScaleCommand(dockerCLI),
35+
newUpdateCommand(dockerCLI),
36+
newLogsCommand(dockerCLI),
37+
newRollbackCommand(dockerCLI),
3138
)
3239
return cmd
3340
}

0 commit comments

Comments
 (0)