Skip to content

Commit ab3fcf9

Browse files
committed
Unexport node commands
This patch deprecates exported node commands and moves the implementation details to an unexported function. Commands that are affected include: - node.NewNodeCommand Signed-off-by: Alano Terblanche <[email protected]>
1 parent 4643b42 commit ab3fcf9

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

cli/command/commands/commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) {
7474
// orchestration (swarm) commands
7575
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
7676
config.NewConfigCommand(dockerCli),
77+
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
7778
node.NewNodeCommand(dockerCli),
7879
secret.NewSecretCommand(dockerCli),
7980
service.NewServiceCommand(dockerCli),

cli/command/node/cmd.go

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,32 @@ import (
1212
)
1313

1414
// NewNodeCommand returns a cobra command for `node` subcommands
15-
func NewNodeCommand(dockerCli command.Cli) *cobra.Command {
15+
//
16+
// Deprecated: Do not import commands directly. They will be removed in a future release.
17+
func NewNodeCommand(dockerCLI command.Cli) *cobra.Command {
18+
return newNodeCommand(dockerCLI)
19+
}
20+
21+
// newNodeCommand returns a cobra command for `node` subcommands
22+
func newNodeCommand(dockerCLI command.Cli) *cobra.Command {
1623
cmd := &cobra.Command{
1724
Use: "node",
1825
Short: "Manage Swarm nodes",
1926
Args: cli.NoArgs,
20-
RunE: command.ShowHelp(dockerCli.Err()),
27+
RunE: command.ShowHelp(dockerCLI.Err()),
2128
Annotations: map[string]string{
2229
"version": "1.24",
2330
"swarm": "manager",
2431
},
2532
}
2633
cmd.AddCommand(
27-
newDemoteCommand(dockerCli),
28-
newInspectCommand(dockerCli),
29-
newListCommand(dockerCli),
30-
newPromoteCommand(dockerCli),
31-
newRemoveCommand(dockerCli),
32-
newPsCommand(dockerCli),
33-
newUpdateCommand(dockerCli),
34+
newDemoteCommand(dockerCLI),
35+
newInspectCommand(dockerCLI),
36+
newListCommand(dockerCLI),
37+
newPromoteCommand(dockerCLI),
38+
newRemoveCommand(dockerCLI),
39+
newPsCommand(dockerCLI),
40+
newUpdateCommand(dockerCLI),
3441
)
3542
return cmd
3643
}

0 commit comments

Comments
 (0)