MCPcopy Create free account
hub / github.com/cli/cli / joinList

Function joinList

pkg/cmd/issue/artifact/delete/delete.go:206–214  ·  view source on GitHub ↗

joinList joins items the way the prompt reads them: "a", "a and b", or "a, b, and c".

(items []string)

Source from the content-addressed store, hash-verified

204// joinList joins items the way the prompt reads them: "a", "a and b", or
205// "a, b, and c".
206func joinList(items []string) string {
207 switch len(items) {
208 case 0, 1:
209 return strings.Join(items, "")
210 case 2:
211 return items[0] + " and " + items[1]
212 }
213 return strings.Join(items[:len(items)-1], ", ") + ", and " + items[len(items)-1]
214}

Callers 1

confirmationPromptFunction · 0.85

Calls 1

JoinMethod · 0.80

Tested by

no test coverage detected