-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Added pr count with list command #440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this idea! some requests:
- instead of adding a new line, put a count in the title and pluralize appropriately. ie, "12 pull requests in owner/repo". There is a pluralize helper in utils that should help with this.
- expand to
issue listalso - include updates to tests
thanks!
32df4bd to
906f496
Compare
| Issues for OWNER/REPO | ||
| No issues match your search in OWNER/REPO | ||
| No issues match your search |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ampinsk Do you think it's alright to collapse the two lines of "no issues" output into one line like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see a screenshot but yes! I'd love to see if we can combine these states into one consistently worded line that sets the context for whatever it is you're looking at right now
utils/utils.go
Outdated
| return fmtDuration(int(ago.Hours()/24/365), "year") | ||
| } | ||
|
|
||
| func GetTitle(cmd *cobra.Command, cmdType string, limit int, matchCount int, baseRepo *ghrepo.Interface) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is only shared between issues and PRs in the command package, I think this function should also live in an (unexported) function in the command package; no need to place it in utils. In fact, we will probably minimize utils over time in favor of splitting things into tiny packages when it makes sense. For this though, I'm fine if it's under command for now.
Thank you for handling this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, will move it to the command package
d75e63d to
0c9909c
Compare
|
Thanks @ShahzadUmair! I'm approving this from a UX perspective, but still needs a final ✅ from @mislav or @vilmibm to ensure the code is where we want it to be prior to merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see more test coverage for getTitle but otherwise it's looking great, thank you!
command/common.go
Outdated
| "github.com/spf13/pflag" | ||
| ) | ||
|
|
||
| func getTitle(cmd *cobra.Command, cmdType string, matchCount int, totalMatchCount int, baseRepo ghrepo.Interface) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding to the test suite!
I'd like to see more test coverage for this function, though. Right now the tests only cover the output of this function when there are no results or when there is no filtering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Also fixed a small bug in resetting command in tests (the limit was not resetting to 30). Could you please take a look now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just adding a note that I've given this a quick review to see if it would make it into today's release, but have decided to hold off merging until I've given it a more thorough review due to the size of the changes. Thank you for all your work so far and your patience 🙇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your hard work! I've simplified the getTitle function (now called listHeader) for readability. Since most tests that you've added just exercised the different variants that getTitle produced, I've replaced them with tests that are scoped just to the new function. These require less boilerplate than command tests and run faster.
|
@mislav Thank you for restructuring code and simplifying tests; looks much better now. |
With 50+ prs open at where I work, it is handy to get a count of how many PRs are being returned from the list command.
After this PR