Merge pull request #6324 from Benehiko/command/registry

Unexport registry commands
This commit is contained in:
Alano Terblanche
2025-08-20 11:43:43 +00:00
committed by GitHub
5 changed files with 29 additions and 5 deletions

View File

@ -43,8 +43,11 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) {
image.NewPushCommand(dockerCli),
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
image.NewImagesCommand(dockerCli),
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
registry.NewLoginCommand(dockerCli),
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
registry.NewLogoutCommand(dockerCli),
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
registry.NewSearchCommand(dockerCli),
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
system.NewVersionCommand(dockerCli),

View File

@ -32,7 +32,14 @@ type loginOptions struct {
}
// NewLoginCommand creates a new `docker login` command
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewLoginCommand(dockerCLI command.Cli) *cobra.Command {
return newLoginCommand(dockerCLI)
}
// newLoginCommand creates a new `docker login` command
func newLoginCommand(dockerCLI command.Cli) *cobra.Command {
var opts loginOptions
cmd := &cobra.Command{

View File

@ -584,7 +584,7 @@ func TestLoginValidateFlags(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
cmd := NewLoginCommand(test.NewFakeCli(&fakeClient{}))
cmd := newLoginCommand(test.NewFakeCli(&fakeClient{}))
cmd.SetOut(io.Discard)
cmd.SetErr(io.Discard)
cmd.SetArgs(tc.args)

View File

@ -13,7 +13,14 @@ import (
)
// NewLogoutCommand creates a new `docker logout` command
func NewLogoutCommand(dockerCli command.Cli) *cobra.Command {
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewLogoutCommand(dockerCLI command.Cli) *cobra.Command {
return newLogoutCommand(dockerCLI)
}
// newLogoutCommand creates a new `docker logout` command
func newLogoutCommand(dockerCLI command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "logout [SERVER]",
Short: "Log out from a registry",
@ -24,7 +31,7 @@ func NewLogoutCommand(dockerCli command.Cli) *cobra.Command {
if len(args) > 0 {
serverAddress = args[0]
}
return runLogout(cmd.Context(), dockerCli, serverAddress)
return runLogout(cmd.Context(), dockerCLI, serverAddress)
},
Annotations: map[string]string{
"category-top": "9",

View File

@ -22,7 +22,14 @@ type searchOptions struct {
}
// NewSearchCommand creates a new `docker search` command
func NewSearchCommand(dockerCli command.Cli) *cobra.Command {
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewSearchCommand(dockerCLI command.Cli) *cobra.Command {
return newSearchCommand(dockerCLI)
}
// newSearchCommand creates a new `docker search` command
func newSearchCommand(dockerCLI command.Cli) *cobra.Command {
options := searchOptions{filter: opts.NewFilterOpt()}
cmd := &cobra.Command{
@ -31,7 +38,7 @@ func NewSearchCommand(dockerCli command.Cli) *cobra.Command {
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
options.term = args[0]
return runSearch(cmd.Context(), dockerCli, options)
return runSearch(cmd.Context(), dockerCLI, options)
},
Annotations: map[string]string{
"category-top": "10",