From 87ce0d887ee2249e550b3adaf9c06c17691c7687 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Tue, 6 Oct 2020 20:05:19 -0700 Subject: [PATCH] Pretty format the GitHub stats Signed-off-by: Chris Cummer --- modules/github/display.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/github/display.go b/modules/github/display.go index c633d21d..bd86922e 100644 --- a/modules/github/display.go +++ b/modules/github/display.go @@ -4,6 +4,8 @@ import ( "fmt" "github.com/google/go-github/v26/github" + "golang.org/x/text/language" + "golang.org/x/text/message" ) func (widget *Widget) display() { @@ -122,11 +124,13 @@ func (widget *Widget) displayMyReviewRequests(repo *GithubRepo, username string) } func (widget *Widget) displayStats(repo *GithubRepo) string { + prntr := message.NewPrinter(language.English) + str := fmt.Sprintf( - " PRs: %d Issues: %d Stars: %d\n", - repo.PullRequestCount(), - repo.IssueCount(), - repo.StarCount(), + " PRs: %s Issues: %s Stars: %s\n", + prntr.Sprintf("%d", repo.PullRequestCount()), + prntr.Sprintf("%d", repo.IssueCount()), + prntr.Sprintf("%d", repo.StarCount()), ) return str