WeKnora/cli/internal/text/pluralize.go

17 lines
577 B
Go

// Package text holds gh-style string helpers for human-readable CLI output.
// All functions are pure (no I/O, no time.Now), making them trivially testable.
package text
import "fmt"
// Pluralize returns "<n> <thing>" or "<n> <thing>s". Mirrors gh
// internal/text/text.go Pluralize signature — simple suffix "s" only;
// irregular forms (person/people) are not supported (add PluralizeIrregular
// when needed, per spec §2.1).
func Pluralize(n int, thing string) string {
if n == 1 {
return fmt.Sprintf("%d %s", n, thing)
}
return fmt.Sprintf("%d %ss", n, thing)
}