From bd8e3e444068710c1c33db7e35155dbe3dc00b54 Mon Sep 17 00:00:00 2001 From: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> Date: Wed, 20 Aug 2025 14:07:45 +0200 Subject: [PATCH] Unexport trust commands This patch deprecates exported trust commands and moves the implementation details to an unexported function. Commands that are affected include: - trust.NewTrustCommand Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> --- cli/command/commands/commands.go | 1 + cli/command/trust/cmd.go | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/cli/command/commands/commands.go b/cli/command/commands/commands.go index 4f1d8783c2..5abf0dc457 100644 --- a/cli/command/commands/commands.go +++ b/cli/command/commands/commands.go @@ -74,6 +74,7 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) { plugin.NewPluginCommand(dockerCli), //nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283) system.NewSystemCommand(dockerCli), + //nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283) trust.NewTrustCommand(dockerCli), //nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283) volume.NewVolumeCommand(dockerCli), diff --git a/cli/command/trust/cmd.go b/cli/command/trust/cmd.go index bb6ceace04..cc0cd6769f 100644 --- a/cli/command/trust/cmd.go +++ b/cli/command/trust/cmd.go @@ -7,19 +7,25 @@ import ( ) // NewTrustCommand returns a cobra command for `trust` subcommands -func NewTrustCommand(dockerCli command.Cli) *cobra.Command { +// +// Deprecated: Do not import commands directly. They will be removed in a future release. +func NewTrustCommand(dockerCLI command.Cli) *cobra.Command { + return newTrustCommand(dockerCLI) +} + +func newTrustCommand(dockerCLI command.Cli) *cobra.Command { cmd := &cobra.Command{ Use: "trust", Short: "Manage trust on Docker images", Args: cli.NoArgs, - RunE: command.ShowHelp(dockerCli.Err()), + RunE: command.ShowHelp(dockerCLI.Err()), } cmd.AddCommand( - newRevokeCommand(dockerCli), - newSignCommand(dockerCli), - newTrustKeyCommand(dockerCli), - newTrustSignerCommand(dockerCli), - newInspectCommand(dockerCli), + newRevokeCommand(dockerCLI), + newSignCommand(dockerCLI), + newTrustKeyCommand(dockerCLI), + newTrustSignerCommand(dockerCLI), + newInspectCommand(dockerCLI), ) return cmd }