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

Function listNames

script/ghmock/checker.go:261–268  ·  view source on GitHub ↗

listNames joins names for messages, shortening long lists.

(names []string, limit int)

Source from the content-addressed store, hash-verified

259
260// listNames joins names for messages, shortening long lists.
261func listNames(names []string, limit int) string {
262 sorted := append([]string(nil), names...)
263 sort.Strings(sorted)
264 if len(sorted) > limit {
265 return strings.Join(sorted[:limit], ", ") + fmt.Sprintf(" and %d more", len(sorted)-limit)
266 }
267 return strings.Join(sorted, ", ")
268}
269
270// dedupe drops repeated problems, keeping the first of each.
271func dedupe(problems []string) []string {

Callers 2

checkObjectMethod · 0.85
checkValueMethod · 0.85

Calls 1

JoinMethod · 0.80

Tested by

no test coverage detected