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

Function newLeaveCommand

cli/command/swarm/leave.go:12–38  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

10)
11
12func newLeaveCommand(dockerCLI command.Cli) *cobra.Command {
13 var opts client.SwarmLeaveOptions
14
15 cmd := &cobra.Command{
16 Use: "leave [OPTIONS]",
17 Short: "Leave the swarm",
18 Args: cli.NoArgs,
19 RunE: func(cmd *cobra.Command, args []string) error {
20 if _, err := dockerCLI.Client().SwarmLeave(cmd.Context(), opts); err != nil {
21 return err
22 }
23
24 _, _ = fmt.Fprintln(dockerCLI.Out(), "Node left the swarm.")
25 return nil
26 },
27 Annotations: map[string]string{
28 "version": "1.24",
29 "swarm": "active",
30 },
31 ValidArgsFunction: cobra.NoFileCompletions,
32 DisableFlagsInUseLine: true,
33 }
34
35 flags := cmd.Flags()
36 flags.BoolVarP(&opts.Force, "force", "f", false, "Force this node to leave the swarm, ignoring warnings")
37 return cmd
38}

Callers 3

TestSwarmLeaveErrorsFunction · 0.85
TestSwarmLeaveFunction · 0.85
newSwarmCommandFunction · 0.85

Calls 3

SwarmLeaveMethod · 0.80
ClientMethod · 0.65
OutMethod · 0.65

Tested by 2

TestSwarmLeaveErrorsFunction · 0.68
TestSwarmLeaveFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…