X Tutup
Skip to content

Add open to issues and pull requests in Pluralize#1457

Merged
mislav merged 2 commits intocli:trunkfrom
ShubhankarKG:openIssuesAndPRs
Jul 31, 2020
Merged

Add open to issues and pull requests in Pluralize#1457
mislav merged 2 commits intocli:trunkfrom
ShubhankarKG:openIssuesAndPRs

Conversation

@ShubhankarKG
Copy link
Copy Markdown
Contributor

Fixes #1449

Added special conditions for only issues and pull requests to add the word open before them. Rest would behave as it was earlier.

Copy link
Copy Markdown
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on!

I think the issue/PR filtering mechanism should choose to display "open" or not, not the Pluralize helper. Also, we should only ever display "open issues/pull requests" when no filters are passed— otherwise we print a message like "N issues match your search". (The latter logic already exists.)

utils/utils.go Outdated
func Pluralize(num int, thing string) string {
if num == 1 {
return fmt.Sprintf("%d %s", num, thing)
isIssueOrPR := thing == "issue" || thing == "pull request"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that the solution belongs in Pluralize, which is a general helper.

The caller of Pluralize should choose what string to pass in as thing. The caller can easily conditionally pass "open pull request" as a word to be pluralized.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I absolutely did not focus on the whether issues or pull requests have filters 🤦

Copy link
Copy Markdown
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you

@mislav mislav merged commit bb6851c into cli:trunk Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tweak wording on list headers to show state

2 participants

X Tutup