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>
This commit is contained in:
Alano Terblanche
2025-08-20 14:07:45 +02:00
parent b2b7187244
commit bd8e3e4440
2 changed files with 14 additions and 7 deletions

View File

@ -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),

View File

@ -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
}