MCPcopy Index your code
hub / github.com/docker/docker-agent / parseAgentPickerRefs

Function parseAgentPickerRefs

cmd/root/agent_picker.go:894–908  ·  view source on GitHub ↗

parseAgentPickerRefs splits a comma-separated list of agent refs, trims whitespace, and drops empty entries. An empty/blank input or the "defaults" sentinel yields the default ref list.

(raw string)

Source from the content-addressed store, hash-verified

892// whitespace, and drops empty entries. An empty/blank input or the
893// "defaults" sentinel yields the default ref list.
894func parseAgentPickerRefs(raw string) []string {
895 if trimmed := strings.TrimSpace(raw); trimmed == "" || trimmed == agentPickerDefaultsSpec {
896 return defaultAgentPickerRefs()
897 }
898 var refs []string
899 for part := range strings.SplitSeq(raw, ",") {
900 if trimmed := strings.TrimSpace(part); trimmed != "" {
901 refs = append(refs, trimmed)
902 }
903 }
904 if len(refs) == 0 {
905 return defaultAgentPickerRefs()
906 }
907 return refs
908}

Callers 3

TestParseAgentPickerRefsFunction · 0.85
runRunCommandMethod · 0.85

Calls 1

defaultAgentPickerRefsFunction · 0.85

Tested by 2

TestParseAgentPickerRefsFunction · 0.68