Skip to content

Commit 0f2721e

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

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

cli/command/commands/commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) {
7878
config.NewConfigCommand(dockerCli),
7979
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
8080
node.NewNodeCommand(dockerCli),
81+
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
8182
secret.NewSecretCommand(dockerCli),
8283
service.NewServiceCommand(dockerCli),
8384
stack.NewStackCommand(dockerCli),

cli/command/secret/cmd.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,28 @@ import (
99
)
1010

1111
// NewSecretCommand returns a cobra command for `secret` subcommands
12-
func NewSecretCommand(dockerCli command.Cli) *cobra.Command {
12+
//
13+
// Deprecated: Do not import commands directly. They will be removed in a future release.
14+
func NewSecretCommand(dockerCLI command.Cli) *cobra.Command {
15+
return newSecretCommand(dockerCLI)
16+
}
17+
18+
func newSecretCommand(dockerCLI command.Cli) *cobra.Command {
1319
cmd := &cobra.Command{
1420
Use: "secret",
1521
Short: "Manage Swarm secrets",
1622
Args: cli.NoArgs,
17-
RunE: command.ShowHelp(dockerCli.Err()),
23+
RunE: command.ShowHelp(dockerCLI.Err()),
1824
Annotations: map[string]string{
1925
"version": "1.25",
2026
"swarm": "manager",
2127
},
2228
}
2329
cmd.AddCommand(
24-
newSecretListCommand(dockerCli),
25-
newSecretCreateCommand(dockerCli),
26-
newSecretInspectCommand(dockerCli),
27-
newSecretRemoveCommand(dockerCli),
30+
newSecretListCommand(dockerCLI),
31+
newSecretCreateCommand(dockerCLI),
32+
newSecretInspectCommand(dockerCLI),
33+
newSecretRemoveCommand(dockerCLI),
2834
)
2935
return cmd
3036
}

0 commit comments

Comments
 (0)