1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Pretty format the GitHub stats

Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
Chris Cummer 2020-10-06 20:05:19 -07:00
parent f7d99c5eff
commit 87ce0d887e

View File

@ -4,6 +4,8 @@ import (
"fmt" "fmt"
"github.com/google/go-github/v26/github" "github.com/google/go-github/v26/github"
"golang.org/x/text/language"
"golang.org/x/text/message"
) )
func (widget *Widget) display() { func (widget *Widget) display() {
@ -122,11 +124,13 @@ func (widget *Widget) displayMyReviewRequests(repo *GithubRepo, username string)
} }
func (widget *Widget) displayStats(repo *GithubRepo) string { func (widget *Widget) displayStats(repo *GithubRepo) string {
prntr := message.NewPrinter(language.English)
str := fmt.Sprintf( str := fmt.Sprintf(
" PRs: %d Issues: %d Stars: %d\n", " PRs: %s Issues: %s Stars: %s\n",
repo.PullRequestCount(), prntr.Sprintf("%d", repo.PullRequestCount()),
repo.IssueCount(), prntr.Sprintf("%d", repo.IssueCount()),
repo.StarCount(), prntr.Sprintf("%d", repo.StarCount()),
) )
return str return str