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

Function newRemoveCommand

cli/command/node/remove.go:18–35  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

16}
17
18func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
19 opts := removeOptions{}
20
21 cmd := &cobra.Command{
22 Use: "rm [OPTIONS] NODE [NODE...]",
23 Aliases: []string{"remove"},
24 Short: "Remove one or more nodes from the swarm",
25 Args: cli.RequiresMinArgs(1),
26 RunE: func(cmd *cobra.Command, args []string) error {
27 return runRemove(cmd.Context(), dockerCLI, args, opts)
28 },
29 ValidArgsFunction: completeNodeNames(dockerCLI),
30 DisableFlagsInUseLine: true,
31 }
32 flags := cmd.Flags()
33 flags.BoolVarP(&opts.force, "force", "f", false, "Force remove a node from the swarm")
34 return cmd
35}
36
37func runRemove(ctx context.Context, dockerCLI command.Cli, nodeIDs []string, opts removeOptions) error {
38 apiClient := dockerCLI.Client()

Callers 3

newNodeCommandFunction · 0.70
TestNodeRemoveErrorsFunction · 0.70
TestNodeRemoveMultipleFunction · 0.70

Calls 2

completeNodeNamesFunction · 0.85
runRemoveFunction · 0.70

Tested by 2

TestNodeRemoveErrorsFunction · 0.56
TestNodeRemoveMultipleFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…