X Tutup
Skip to content

Commit bb6851c

Browse files
authored
Add "open" qualifier when listing open issues/PRs (cli#1457)
1 parent 88eaa28 commit bb6851c

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

command/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ func listHeader(repoName string, itemName string, matchCount int, totalMatchCoun
376376
return fmt.Sprintf("Showing %d of %s in %s that %s your search", matchCount, utils.Pluralize(totalMatchCount, itemName), repoName, matchVerb)
377377
}
378378

379-
return fmt.Sprintf("Showing %d of %s in %s", matchCount, utils.Pluralize(totalMatchCount, itemName), repoName)
379+
return fmt.Sprintf("Showing %d of %s in %s", matchCount, utils.Pluralize(totalMatchCount, fmt.Sprintf("open %s", itemName)), repoName)
380380
}
381381

382382
func printRawIssuePreview(out io.Writer, issue *api.Issue) error {

command/issue_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func TestIssueList_tty(t *testing.T) {
145145
}
146146

147147
eq(t, output.Stderr(), `
148-
Showing 3 of 3 issues in OWNER/REPO
148+
Showing 3 of 3 open issues in OWNER/REPO
149149
150150
`)
151151

@@ -847,7 +847,7 @@ func Test_listHeader(t *testing.T) {
847847
totalMatchCount: 23,
848848
hasFilters: false,
849849
},
850-
want: "Showing 1 of 23 genies in REPO",
850+
want: "Showing 1 of 23 open genies in REPO",
851851
},
852852
{
853853
name: "one result after filters",
@@ -869,7 +869,7 @@ func Test_listHeader(t *testing.T) {
869869
totalMatchCount: 1,
870870
hasFilters: false,
871871
},
872-
want: "Showing 1 of 1 chip in REPO",
872+
want: "Showing 1 of 1 open chip in REPO",
873873
},
874874
{
875875
name: "one result in total after filters",
@@ -891,7 +891,7 @@ func Test_listHeader(t *testing.T) {
891891
totalMatchCount: 23,
892892
hasFilters: false,
893893
},
894-
want: "Showing 4 of 23 plants in REPO",
894+
want: "Showing 4 of 23 open plants in REPO",
895895
},
896896
{
897897
name: "multiple results after filters",

command/pr_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func TestPRList(t *testing.T) {
307307
}
308308

309309
assert.Equal(t, `
310-
Showing 3 of 3 pull requests in OWNER/REPO
310+
Showing 3 of 3 open pull requests in OWNER/REPO
311311
312312
`, output.Stderr())
313313

utils/utils.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ func RenderMarkdown(text string) (string, error) {
4848
func Pluralize(num int, thing string) string {
4949
if num == 1 {
5050
return fmt.Sprintf("%d %s", num, thing)
51-
} else {
52-
return fmt.Sprintf("%d %ss", num, thing)
5351
}
52+
return fmt.Sprintf("%d %ss", num, thing)
5453
}
5554

5655
func fmtDuration(amount int, unit string) string {

0 commit comments

Comments
 (0)
X Tutup