From 12ca7d8fc2e387870f7cc7789c4f169370dc13ca Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Fri, 24 Jul 2026 16:21:18 +0100 Subject: [PATCH] pluralise draw only if entries>1 --- README.md | 2 +- cmd/lottery/render.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e0e4955..a366c96 100644 --- a/README.md +++ b/README.md @@ -69,5 +69,5 @@ lottery -k=euromillions -c=3 ## Special Thanks -- [spf13](https://github.com/spf13) for the [cobra](https://github.com/spf13/cobra) package. +- [spf13](https://github.com/spf13) for the [cobra](https://github.com/spf13/cobra) and [viper](https://github.com/spf13/viper) packages. - [Charm](https://github.com/charmbracelet) developers for the [fang](https://github.com/charmbracelet/fang), [lipgloss](https://github.com/charmbracelet/lipgloss) and [huh](https://github.com/charmbracelet/huh) packages. \ No newline at end of file diff --git a/cmd/lottery/render.go b/cmd/lottery/render.go index 2853934..dbfd9d8 100644 --- a/cmd/lottery/render.go +++ b/cmd/lottery/render.go @@ -141,6 +141,11 @@ func renderDrawCollection(title string, entries []string) string { separator := separatorStyle.Render(strings.Repeat("─", maxLineWidth(entries))) body := strings.Join(entries, "\n"+separator+"\n") + if len(entries) == 1 { + title = titleStyle.Render(title + " draw") + } else { + title = titleStyle.Render(title + " draws") + } - return cardStyle.Render(titleStyle.Render(title+" draws") + "\n" + body) + return cardStyle.Render(title + "\n" + body) }