From bb6851c88b2393e7f69c2a7637f4f81897c8db4e Mon Sep 17 00:00:00 2001 From: Shubhankar Kanchan Gupta Date: Fri, 31 Jul 2020 21:52:08 +0530 Subject: [PATCH] Add "open" qualifier when listing open issues/PRs (#1457) --- command/issue.go | 2 +- command/issue_test.go | 8 ++++---- command/pr_test.go | 2 +- utils/utils.go | 3 +-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/command/issue.go b/command/issue.go index 43049faa2..3e481ef8e 100644 --- a/command/issue.go +++ b/command/issue.go @@ -376,7 +376,7 @@ func listHeader(repoName string, itemName string, matchCount int, totalMatchCoun return fmt.Sprintf("Showing %d of %s in %s that %s your search", matchCount, utils.Pluralize(totalMatchCount, itemName), repoName, matchVerb) } - return fmt.Sprintf("Showing %d of %s in %s", matchCount, utils.Pluralize(totalMatchCount, itemName), repoName) + return fmt.Sprintf("Showing %d of %s in %s", matchCount, utils.Pluralize(totalMatchCount, fmt.Sprintf("open %s", itemName)), repoName) } func printRawIssuePreview(out io.Writer, issue *api.Issue) error { diff --git a/command/issue_test.go b/command/issue_test.go index 7e7532a1e..8cde92d6e 100644 --- a/command/issue_test.go +++ b/command/issue_test.go @@ -145,7 +145,7 @@ func TestIssueList_tty(t *testing.T) { } eq(t, output.Stderr(), ` -Showing 3 of 3 issues in OWNER/REPO +Showing 3 of 3 open issues in OWNER/REPO `) @@ -847,7 +847,7 @@ func Test_listHeader(t *testing.T) { totalMatchCount: 23, hasFilters: false, }, - want: "Showing 1 of 23 genies in REPO", + want: "Showing 1 of 23 open genies in REPO", }, { name: "one result after filters", @@ -869,7 +869,7 @@ func Test_listHeader(t *testing.T) { totalMatchCount: 1, hasFilters: false, }, - want: "Showing 1 of 1 chip in REPO", + want: "Showing 1 of 1 open chip in REPO", }, { name: "one result in total after filters", @@ -891,7 +891,7 @@ func Test_listHeader(t *testing.T) { totalMatchCount: 23, hasFilters: false, }, - want: "Showing 4 of 23 plants in REPO", + want: "Showing 4 of 23 open plants in REPO", }, { name: "multiple results after filters", diff --git a/command/pr_test.go b/command/pr_test.go index fdf314022..f11939b1b 100644 --- a/command/pr_test.go +++ b/command/pr_test.go @@ -307,7 +307,7 @@ func TestPRList(t *testing.T) { } assert.Equal(t, ` -Showing 3 of 3 pull requests in OWNER/REPO +Showing 3 of 3 open pull requests in OWNER/REPO `, output.Stderr()) diff --git a/utils/utils.go b/utils/utils.go index 5751f55dd..20a5e55a8 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -48,9 +48,8 @@ func RenderMarkdown(text string) (string, error) { func Pluralize(num int, thing string) string { if num == 1 { return fmt.Sprintf("%d %s", num, thing) - } else { - return fmt.Sprintf("%d %ss", num, thing) } + return fmt.Sprintf("%d %ss", num, thing) } func fmtDuration(amount int, unit string) string {