Skip to content

Commit b2b7187

Browse files
authored
Merge pull request #6324 from Benehiko/command/registry
Unexport registry commands
2 parents 7dfcb06 + d4588c7 commit b2b7187

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

cli/command/commands/commands.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) {
4343
image.NewPushCommand(dockerCli),
4444
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
4545
image.NewImagesCommand(dockerCli),
46+
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
4647
registry.NewLoginCommand(dockerCli),
48+
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
4749
registry.NewLogoutCommand(dockerCli),
50+
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
4851
registry.NewSearchCommand(dockerCli),
4952
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
5053
system.NewVersionCommand(dockerCli),

cli/command/registry/login.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ type loginOptions struct {
3232
}
3333

3434
// NewLoginCommand creates a new `docker login` command
35+
//
36+
// Deprecated: Do not import commands directly. They will be removed in a future release.
3537
func NewLoginCommand(dockerCLI command.Cli) *cobra.Command {
38+
return newLoginCommand(dockerCLI)
39+
}
40+
41+
// newLoginCommand creates a new `docker login` command
42+
func newLoginCommand(dockerCLI command.Cli) *cobra.Command {
3643
var opts loginOptions
3744

3845
cmd := &cobra.Command{

cli/command/registry/login_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ func TestLoginValidateFlags(t *testing.T) {
584584
},
585585
} {
586586
t.Run(tc.name, func(t *testing.T) {
587-
cmd := NewLoginCommand(test.NewFakeCli(&fakeClient{}))
587+
cmd := newLoginCommand(test.NewFakeCli(&fakeClient{}))
588588
cmd.SetOut(io.Discard)
589589
cmd.SetErr(io.Discard)
590590
cmd.SetArgs(tc.args)

cli/command/registry/logout.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ import (
1313
)
1414

1515
// NewLogoutCommand creates a new `docker logout` command
16-
func NewLogoutCommand(dockerCli command.Cli) *cobra.Command {
16+
//
17+
// Deprecated: Do not import commands directly. They will be removed in a future release.
18+
func NewLogoutCommand(dockerCLI command.Cli) *cobra.Command {
19+
return newLogoutCommand(dockerCLI)
20+
}
21+
22+
// newLogoutCommand creates a new `docker logout` command
23+
func newLogoutCommand(dockerCLI command.Cli) *cobra.Command {
1724
cmd := &cobra.Command{
1825
Use: "logout [SERVER]",
1926
Short: "Log out from a registry",
@@ -24,7 +31,7 @@ func NewLogoutCommand(dockerCli command.Cli) *cobra.Command {
2431
if len(args) > 0 {
2532
serverAddress = args[0]
2633
}
27-
return runLogout(cmd.Context(), dockerCli, serverAddress)
34+
return runLogout(cmd.Context(), dockerCLI, serverAddress)
2835
},
2936
Annotations: map[string]string{
3037
"category-top": "9",

cli/command/registry/search.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ type searchOptions struct {
2222
}
2323

2424
// NewSearchCommand creates a new `docker search` command
25-
func NewSearchCommand(dockerCli command.Cli) *cobra.Command {
25+
//
26+
// Deprecated: Do not import commands directly. They will be removed in a future release.
27+
func NewSearchCommand(dockerCLI command.Cli) *cobra.Command {
28+
return newSearchCommand(dockerCLI)
29+
}
30+
31+
// newSearchCommand creates a new `docker search` command
32+
func newSearchCommand(dockerCLI command.Cli) *cobra.Command {
2633
options := searchOptions{filter: opts.NewFilterOpt()}
2734

2835
cmd := &cobra.Command{
@@ -31,7 +38,7 @@ func NewSearchCommand(dockerCli command.Cli) *cobra.Command {
3138
Args: cli.ExactArgs(1),
3239
RunE: func(cmd *cobra.Command, args []string) error {
3340
options.term = args[0]
34-
return runSearch(cmd.Context(), dockerCli, options)
41+
return runSearch(cmd.Context(), dockerCLI, options)
3542
},
3643
Annotations: map[string]string{
3744
"category-top": "10",

0 commit comments

Comments
 (0)