Skip to content

Commit 88178ed

Browse files
committed
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]>
1 parent 1d34432 commit 88178ed

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

cli/command/commands/commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) {
7979
node.NewNodeCommand(dockerCli),
8080
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
8181
secret.NewSecretCommand(dockerCli),
82+
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
8283
service.NewServiceCommand(dockerCli),
8384
stack.NewStackCommand(dockerCli),
8485
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)