Add "open" qualifier when listing open issues/PRs (#1457)

This commit is contained in:
Shubhankar Kanchan Gupta 2020-07-31 21:52:08 +05:30 committed by GitHub
parent 88eaa28aef
commit bb6851c88b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 8 deletions

View file

@ -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 {

View file

@ -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",

View file

@ -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())

View file

@ -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 {