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

Function newUpdateCommand

cli/command/swarm/update.go:14–41  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

12)
13
14func newUpdateCommand(dockerCLI command.Cli) *cobra.Command {
15 opts := swarmOptions{}
16
17 cmd := &cobra.Command{
18 Use: "update [OPTIONS]",
19 Short: "Update the swarm",
20 Args: cli.NoArgs,
21 RunE: func(cmd *cobra.Command, args []string) error {
22 return runUpdate(cmd.Context(), dockerCLI, cmd.Flags(), opts)
23 },
24 PreRunE: func(cmd *cobra.Command, args []string) error {
25 if cmd.Flags().NFlag() == 0 {
26 return pflag.ErrHelp
27 }
28 return nil
29 },
30 Annotations: map[string]string{
31 "version": "1.24",
32 "swarm": "manager",
33 },
34 ValidArgsFunction: cobra.NoFileCompletions,
35 DisableFlagsInUseLine: true,
36 }
37
38 cmd.Flags().BoolVar(&opts.autolock, flagAutolock, false, "Change manager autolocking setting (true|false)")
39 addSwarmFlags(cmd.Flags(), &opts)
40 return cmd
41}
42
43func runUpdate(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, opts swarmOptions) error {
44 apiClient := dockerCLI.Client()

Callers 3

newSwarmCommandFunction · 0.70
TestSwarmUpdateErrorsFunction · 0.70
TestSwarmUpdateFunction · 0.70

Calls 2

addSwarmFlagsFunction · 0.85
runUpdateFunction · 0.70

Tested by 2

TestSwarmUpdateErrorsFunction · 0.56
TestSwarmUpdateFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…