Skip to content

Commit bf9173f

Browse files
authored
Merge pull request #6323 from Benehiko/command/stack
Unexport stack commands
2 parents 89316e1 + 630fe43 commit bf9173f

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

cli/command/commands/commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func AddCommands(cmd *cobra.Command, dockerCli command.Cli) {
8383
secret.NewSecretCommand(dockerCli),
8484
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
8585
service.NewServiceCommand(dockerCli),
86+
//nolint:staticcheck // TODO: Remove when migration to cli/internal/commands.Register is complete. (see #6283)
8687
stack.NewStackCommand(dockerCli),
8788
swarm.NewSwarmCommand(dockerCli),
8889

cli/command/stack/cmd.go

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ import (
1111
)
1212

1313
// NewStackCommand returns a cobra command for `stack` subcommands
14-
func NewStackCommand(dockerCli command.Cli) *cobra.Command {
14+
//
15+
// Deprecated: Do not import commands directly. They will be removed in a future release.
16+
func NewStackCommand(dockerCLI command.Cli) *cobra.Command {
17+
return newStackCommand(dockerCLI)
18+
}
19+
20+
// newStackCommand returns a cobra command for `stack` subcommands
21+
func newStackCommand(dockerCLI command.Cli) *cobra.Command {
1522
cmd := &cobra.Command{
1623
Use: "stack [OPTIONS]",
1724
Short: "Manage Swarm stacks",
1825
Args: cli.NoArgs,
19-
RunE: command.ShowHelp(dockerCli.Err()),
26+
RunE: command.ShowHelp(dockerCLI.Err()),
2027
Annotations: map[string]string{
2128
"version": "1.25",
2229
"swarm": "manager",
@@ -25,18 +32,18 @@ func NewStackCommand(dockerCli command.Cli) *cobra.Command {
2532
defaultHelpFunc := cmd.HelpFunc()
2633
cmd.SetHelpFunc(func(c *cobra.Command, args []string) {
2734
if err := cmd.Root().PersistentPreRunE(c, args); err != nil {
28-
fmt.Fprintln(dockerCli.Err(), err)
35+
fmt.Fprintln(dockerCLI.Err(), err)
2936
return
3037
}
3138
defaultHelpFunc(c, args)
3239
})
3340
cmd.AddCommand(
34-
newDeployCommand(dockerCli),
35-
newListCommand(dockerCli),
36-
newPsCommand(dockerCli),
37-
newRemoveCommand(dockerCli),
38-
newServicesCommand(dockerCli),
39-
newConfigCommand(dockerCli),
41+
newDeployCommand(dockerCLI),
42+
newListCommand(dockerCLI),
43+
newPsCommand(dockerCLI),
44+
newRemoveCommand(dockerCLI),
45+
newServicesCommand(dockerCLI),
46+
newConfigCommand(dockerCLI),
4047
)
4148
flags := cmd.PersistentFlags()
4249
flags.String("orchestrator", "", "Orchestrator to use (swarm|all)")

0 commit comments

Comments
 (0)