Files
docker-cli/cli/command/trust/cmd.go
Alano Terblanche 56cab16779 Register CLI commands implicitly
This patch removes the explicit `commands.AddCommands` function and
instead relies upon the `internal/commands` package which registers each
CLI command using `init()` instead.

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2025-08-21 07:16:35 +02:00

37 lines
882 B
Go

package trust
import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/internal/commands"
"github.com/spf13/cobra"
)
func init() {
commands.Register(newTrustCommand)
}
// NewTrustCommand returns a cobra command for `trust` subcommands
//
// 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()),
}
cmd.AddCommand(
newRevokeCommand(dockerCLI),
newSignCommand(dockerCLI),
newTrustKeyCommand(dockerCLI),
newTrustSignerCommand(dockerCLI),
newInspectCommand(dockerCLI),
)
return cmd
}