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

Function formatStars

pkg/cmd/skills/search/search.go:888–893  ·  view source on GitHub ↗

formatStars formats a star count for display (e.g. 1700 > "1.7k"). TODO kw: Could be swapped for go-humanize.

(n int)

Source from the content-addressed store, hash-verified

886// formatStars formats a star count for display (e.g. 1700 > "1.7k").
887// TODO kw: Could be swapped for go-humanize.
888func formatStars(n int) string {
889 if n >= 1000 {
890 return fmt.Sprintf("%.1fk", float64(n)/1000)
891 }
892 return fmt.Sprintf("%d", n)
893}
894
895// repoInfo holds the subset of repository metadata we fetch for ranking.
896type repoInfo struct {

Callers 3

renderTableFunction · 0.85
promptInstallFunction · 0.85
TestFormatStarsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFormatStarsFunction · 0.68