Skip to content

Commit 3b0edc7

Browse files
committed
Unexport context command
This patch deprecates exported context commands and moves the implementation details to an unexported function. Commands that are affected include: - context.NewContextCommand Signed-off-by: Alano Terblanche <[email protected]>
1 parent 89316e1 commit 3b0edc7

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

cli/command/commands/commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) {
6060
checkpoint.NewCheckpointCommand(dockerCli),
6161
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
6262
container.NewContainerCommand(dockerCli),
63+
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
6364
context.NewContextCommand(dockerCli),
6465
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
6566
image.NewImageCommand(dockerCli),

cli/command/context/cmd.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,30 @@ import (
77
)
88

99
// NewContextCommand returns the context cli subcommand
10-
func NewContextCommand(dockerCli command.Cli) *cobra.Command {
10+
//
11+
// Deprecated: Do not import commands directly. They will be removed in a future release.
12+
func NewContextCommand(dockerCLI command.Cli) *cobra.Command {
13+
return newContextCommand(dockerCLI)
14+
}
15+
16+
// newContextCommand returns the context cli subcommand
17+
func newContextCommand(dockerCLI command.Cli) *cobra.Command {
1118
cmd := &cobra.Command{
1219
Use: "context",
1320
Short: "Manage contexts",
1421
Args: cli.NoArgs,
15-
RunE: command.ShowHelp(dockerCli.Err()),
22+
RunE: command.ShowHelp(dockerCLI.Err()),
1623
}
1724
cmd.AddCommand(
18-
newCreateCommand(dockerCli),
19-
newListCommand(dockerCli),
20-
newUseCommand(dockerCli),
21-
newExportCommand(dockerCli),
22-
newImportCommand(dockerCli),
23-
newRemoveCommand(dockerCli),
24-
newUpdateCommand(dockerCli),
25-
newInspectCommand(dockerCli),
26-
newShowCommand(dockerCli),
25+
newCreateCommand(dockerCLI),
26+
newListCommand(dockerCLI),
27+
newUseCommand(dockerCLI),
28+
newExportCommand(dockerCLI),
29+
newImportCommand(dockerCLI),
30+
newRemoveCommand(dockerCLI),
31+
newUpdateCommand(dockerCLI),
32+
newInspectCommand(dockerCLI),
33+
newShowCommand(dockerCLI),
2734
)
2835
return cmd
2936
}

0 commit comments

Comments
 (0)