Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ShahzadUmair
Copy link
Contributor

@ShahzadUmair ShahzadUmair commented Feb 14, 2020

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

Screenshot 2020-02-27 at 1 40 46 AM

Screenshot 2020-02-27 at 1 09 32 AM

Screenshot 2020-02-27 at 1 10 00 AM

Screenshot 2020-02-27 at 1 22 54 AM

Screenshot 2020-02-27 at 1 10 59 AM

@ShahzadUmair ShahzadUmair marked this pull request as ready for review February 14, 2020 10:01
@ShahzadUmair ShahzadUmair requested review from mislav and vilmibm and removed request for mislav February 14, 2020 10:01
Copy link

@marcusleemitchell marcusleemitchell left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏼

Copy link
Contributor

@vilmibm vilmibm left a 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 list also
  • include updates to tests

thanks!

@ShahzadUmair ShahzadUmair requested a review from vilmibm February 15, 2020 18:06
Issues for OWNER/REPO
No issues match your search in OWNER/REPO
No issues match your search
Copy link
Contributor

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?

Copy link
Contributor

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 {
Copy link
Contributor

@mislav mislav Feb 19, 2020

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!

Copy link
Contributor Author

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

@tierninho tierninho added enhancement a request to improve CLI issue and removed enhancement a request to improve CLI issue labels Feb 21, 2020
@billygriffin
Copy link
Contributor

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.

Copy link
Contributor

@vilmibm vilmibm left a 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!

"github.com/spf13/pflag"
)

func getTitle(cmd *cobra.Command, cmdType string, matchCount int, totalMatchCount int, baseRepo ghrepo.Interface) string {
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks!

Copy link
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.

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 🙇

Copy link
Contributor

@sadikkuzu sadikkuzu left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
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.

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.

@ShahzadUmair
Copy link
Contributor Author

@mislav Thank you for restructuring code and simplifying tests; looks much better now.

@vilmibm vilmibm merged commit c1e7588 into cli:master Mar 18, 2020
Stonre pushed a commit to Stonre/strands-fork that referenced this pull request Jul 21, 2025
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.

10 participants