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

Function ImageNames

cli/command/completion/functions.go:24–39  ·  view source on GitHub ↗

ImageNames offers completion for images present within the local store

(dockerCLI APIClientProvider, limit int)

Source from the content-addressed store, hash-verified

22
23// ImageNames offers completion for images present within the local store
24func ImageNames(dockerCLI APIClientProvider, limit int) cobra.CompletionFunc {
25 return Unique(func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
26 if limit > 0 && len(args) >= limit {
27 return nil, cobra.ShellCompDirectiveNoFileComp
28 }
29 res, err := dockerCLI.Client().ImageList(cmd.Context(), client.ImageListOptions{})
30 if err != nil {
31 return nil, cobra.ShellCompDirectiveError
32 }
33 var names []string
34 for _, img := range res.Items {
35 names = append(names, img.RepoTags...)
36 }
37 return names, cobra.ShellCompDirectiveNoFileComp
38 })
39}
40
41// ImageNamesWithBase offers completion for images present within the local store,
42// including both full image names with tags and base image names (repository names only)

Callers 1

TestCompleteImageNamesFunction · 0.85

Calls 3

UniqueFunction · 0.85
ClientMethod · 0.65
ImageListMethod · 0.45

Tested by 1

TestCompleteImageNamesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…