MCPcopy
hub / github.com/containers/toolbox / completionContainerNamesFiltered

Function completionContainerNamesFiltered

src/cmd/completion.go:86–113  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string, _ string)

Source from the content-addressed store, hash-verified

84}
85
86func completionContainerNamesFiltered(cmd *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
87 if cmd.Name() == "enter" && len(args) >= 1 {
88 return nil, cobra.ShellCompDirectiveNoFileComp
89 }
90
91 var containerNames []string
92 if containers, err := getContainers(); err == nil {
93 for _, container := range containers {
94 name := container.Name()
95 skip := false
96 for _, arg := range args {
97 if name == arg {
98 skip = true
99 break
100 }
101 }
102
103 if skip {
104 continue
105 }
106
107 containerNames = append(containerNames, name)
108 }
109 }
110
111 return containerNames, cobra.ShellCompDirectiveNoFileComp
112
113}
114
115func completionDistroNames(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
116 imageFlag := cmd.Flag("image")

Callers

nothing calls this directly

Calls 2

getContainersFunction · 0.85
NameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…