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

Function newUpdateCommand

cli/command/volume/update.go:16–40  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

14)
15
16func newUpdateCommand(dockerCLI command.Cli) *cobra.Command {
17 var availability string
18
19 cmd := &cobra.Command{
20 Use: "update [OPTIONS] [VOLUME]",
21 Short: "Update a volume (cluster volumes only)",
22 Args: cli.ExactArgs(1),
23 RunE: func(cmd *cobra.Command, args []string) error {
24 return runUpdate(cmd.Context(), dockerCLI, args[0], availability, cmd.Flags())
25 },
26 Annotations: map[string]string{
27 "version": "1.42",
28 "swarm": "manager",
29 },
30 ValidArgsFunction: completion.VolumeNames(dockerCLI),
31 DisableFlagsInUseLine: true,
32 }
33
34 flags := cmd.Flags()
35 flags.StringVar(&availability, "availability", "active", `Cluster Volume availability ("active", "pause", "drain")`)
36 _ = flags.SetAnnotation("availability", "version", []string{"1.42"})
37 _ = flags.SetAnnotation("availability", "swarm", []string{"manager"})
38
39 return cmd
40}
41
42func runUpdate(ctx context.Context, dockerCli command.Cli, volumeID, availability string, flags *pflag.FlagSet) error {
43 // TODO(dperny): For this earliest version, the only thing that can be

Callers 2

newVolumeCommandFunction · 0.70
TestUpdateCmdFunction · 0.70

Calls 1

runUpdateFunction · 0.70

Tested by 1

TestUpdateCmdFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…