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

Function VolumeNames

cli/command/completion/functions.go:116–128  ·  view source on GitHub ↗

VolumeNames offers completion for volumes

(dockerCLI APIClientProvider)

Source from the content-addressed store, hash-verified

114
115// VolumeNames offers completion for volumes
116func VolumeNames(dockerCLI APIClientProvider) cobra.CompletionFunc {
117 return Unique(func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
118 res, err := dockerCLI.Client().VolumeList(cmd.Context(), client.VolumeListOptions{})
119 if err != nil {
120 return nil, cobra.ShellCompDirectiveError
121 }
122 var names []string
123 for _, vol := range res.Items {
124 names = append(names, vol.Name)
125 }
126 return names, cobra.ShellCompDirectiveNoFileComp
127 })
128}
129
130// NetworkNames offers completion for networks
131func NetworkNames(dockerCLI APIClientProvider) cobra.CompletionFunc {

Callers 1

TestCompleteVolumeNamesFunction · 0.85

Calls 3

UniqueFunction · 0.85
ClientMethod · 0.65
VolumeListMethod · 0.45

Tested by 1

TestCompleteVolumeNamesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…