Skip to content

Commit c580c97

Browse files
BenehikothaJeztah
authored andcommitted
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]> (cherry picked from commit ab3fcf9) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent ba8b22e commit c580c97

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

cli/command/commands/commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) {
7575
// orchestration (swarm) commands
7676
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
7777
config.NewConfigCommand(dockerCli),
78+
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
7879
node.NewNodeCommand(dockerCli),
7980
secret.NewSecretCommand(dockerCli),
8081
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)