From e00762ed7d5f929ee75f9dd95e4ee1ca7dd02f0d Mon Sep 17 00:00:00 2001 From: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> Date: Wed, 20 Aug 2025 12:45:11 +0200 Subject: [PATCH] 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 <18033717+Benehiko@users.noreply.github.com> --- cli/command/commands/commands.go | 1 + cli/command/secret/cmd.go | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cli/command/commands/commands.go b/cli/command/commands/commands.go index 8abe3a3ac4..3ab9dbb783 100644 --- a/cli/command/commands/commands.go +++ b/cli/command/commands/commands.go @@ -75,6 +75,7 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) { //nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283) config.NewConfigCommand(dockerCli), node.NewNodeCommand(dockerCli), + //nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283) secret.NewSecretCommand(dockerCli), service.NewServiceCommand(dockerCli), stack.NewStackCommand(dockerCli), diff --git a/cli/command/secret/cmd.go b/cli/command/secret/cmd.go index a3e9f08c86..8e5ca4da50 100644 --- a/cli/command/secret/cmd.go +++ b/cli/command/secret/cmd.go @@ -9,22 +9,28 @@ import ( ) // NewSecretCommand returns a cobra command for `secret` subcommands -func NewSecretCommand(dockerCli command.Cli) *cobra.Command { +// +// Deprecated: Do not import commands directly. They will be removed in a future release. +func NewSecretCommand(dockerCLI command.Cli) *cobra.Command { + return newSecretCommand(dockerCLI) +} + +func newSecretCommand(dockerCLI command.Cli) *cobra.Command { cmd := &cobra.Command{ Use: "secret", Short: "Manage Swarm secrets", Args: cli.NoArgs, - RunE: command.ShowHelp(dockerCli.Err()), + RunE: command.ShowHelp(dockerCLI.Err()), Annotations: map[string]string{ "version": "1.25", "swarm": "manager", }, } cmd.AddCommand( - newSecretListCommand(dockerCli), - newSecretCreateCommand(dockerCli), - newSecretInspectCommand(dockerCli), - newSecretRemoveCommand(dockerCli), + newSecretListCommand(dockerCLI), + newSecretCreateCommand(dockerCLI), + newSecretInspectCommand(dockerCLI), + newSecretRemoveCommand(dockerCLI), ) return cmd }