MCPcopy Index your code
hub / github.com/docker/cli / newRemoveCommand

Function newRemoveCommand

cli/command/stack/remove.go:23–45  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

21}
22
23func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
24 var opts removeOptions
25
26 cmd := &cobra.Command{
27 Use: "rm [OPTIONS] STACK [STACK...]",
28 Aliases: []string{"remove", "down"},
29 Short: "Remove one or more stacks",
30 Args: cli.RequiresMinArgs(1),
31 RunE: func(cmd *cobra.Command, args []string) error {
32 opts.namespaces = args
33 if err := validateStackNames(opts.namespaces); err != nil {
34 return err
35 }
36 return runRemove(cmd.Context(), dockerCLI, opts)
37 },
38 ValidArgsFunction: completeNames(dockerCLI),
39 DisableFlagsInUseLine: true,
40 }
41
42 flags := cmd.Flags()
43 flags.BoolVarP(&opts.detach, "detach", "d", true, "Do not wait for stack removal")
44 return cmd
45}
46
47// runRemove is the swarm implementation of docker stack remove.
48func runRemove(ctx context.Context, dockerCli command.Cli, opts removeOptions) error {

Callers 5

newStackCommandFunction · 0.70
TestRemoveWithEmptyNameFunction · 0.70
TestRemoveStackSkipEmptyFunction · 0.70

Calls 3

validateStackNamesFunction · 0.85
runRemoveFunction · 0.70
completeNamesFunction · 0.70

Tested by 4

TestRemoveWithEmptyNameFunction · 0.56
TestRemoveStackSkipEmptyFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…