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

Function serviceNames

cli/command/system/completion.go:269–279  ·  view source on GitHub ↗

serviceNames contacts the API to get a list of service names. In case of an error, an empty list is returned.

(dockerCLI completion.APIClientProvider, cmd *cobra.Command)

Source from the content-addressed store, hash-verified

267// serviceNames contacts the API to get a list of service names.
268// In case of an error, an empty list is returned.
269func serviceNames(dockerCLI completion.APIClientProvider, cmd *cobra.Command) []string {
270 res, err := dockerCLI.Client().ServiceList(cmd.Context(), client.ServiceListOptions{})
271 if err != nil {
272 return []string{}
273 }
274 names := make([]string, 0, len(res.Items))
275 for _, v := range res.Items {
276 names = append(names, v.Spec.Name)
277 }
278 return names
279}
280
281// taskNames contacts the API to get a list of service names.
282// In case of an error, an empty list is returned.

Callers 1

completeObjectNamesFunction · 0.85

Calls 2

ClientMethod · 0.65
ServiceListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…