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

Function newRemoveCommand

cli/command/volume/remove.go:21–42  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

19}
20
21func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
22 var opts removeOptions
23
24 cmd := &cobra.Command{
25 Use: "rm [OPTIONS] VOLUME [VOLUME...]",
26 Aliases: []string{"remove"},
27 Short: "Remove one or more volumes",
28 Long: "Remove one or more volumes. You cannot remove a volume that is in use by a container.",
29 Args: cli.RequiresMinArgs(1),
30 RunE: func(cmd *cobra.Command, args []string) error {
31 opts.volumes = args
32 return runRemove(cmd.Context(), dockerCLI, &opts)
33 },
34 ValidArgsFunction: completion.VolumeNames(dockerCLI),
35 DisableFlagsInUseLine: true,
36 }
37
38 flags := cmd.Flags()
39 flags.BoolVarP(&opts.force, "force", "f", false, "Force the removal of one or more volumes")
40 _ = flags.SetAnnotation("force", "version", []string{"1.25"})
41 return cmd
42}
43
44func runRemove(ctx context.Context, dockerCLI command.Cli, opts *removeOptions) error {
45 apiClient := dockerCLI.Client()

Callers 3

newVolumeCommandFunction · 0.70
TestVolumeRemoveErrorsFunction · 0.70
TestNodeRemoveMultipleFunction · 0.70

Calls 1

runRemoveFunction · 0.70

Tested by 2

TestVolumeRemoveErrorsFunction · 0.56
TestNodeRemoveMultipleFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…