Make it work with PRs
This commit is contained in:
parent
4fcf13dac4
commit
c9bcf807b1
2 changed files with 9 additions and 7 deletions
|
|
@ -329,7 +329,7 @@ func printIssues(w io.Writer, prefix string, totalCount int, issues []api.Issue)
|
|||
}
|
||||
remaining := totalCount - len(issues)
|
||||
if remaining > 0 {
|
||||
fmt.Fprintf(w, utils.Gray("%sAnd %d more"), prefix, remaining)
|
||||
fmt.Fprintf(w, utils.Gray("%sAnd %d more\n"), prefix, remaining)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,11 +97,9 @@ func prStatus(cmd *cobra.Command, args []string) error {
|
|||
|
||||
out := colorableOut(cmd)
|
||||
|
||||
fmt.Printf("🌭 %+v\n", prPayload)
|
||||
|
||||
printHeader(out, "Current branch")
|
||||
if prPayload.CurrentPR != nil {
|
||||
printPrs(out, *prPayload.CurrentPR)
|
||||
printPrs(out, 0, *prPayload.CurrentPR)
|
||||
} else {
|
||||
message := fmt.Sprintf(" There is no pull request associated with %s", utils.Cyan("["+currentPRHeadRef+"]"))
|
||||
printMessage(out, message)
|
||||
|
|
@ -110,7 +108,7 @@ func prStatus(cmd *cobra.Command, args []string) error {
|
|||
|
||||
printHeader(out, "Created by you")
|
||||
if prPayload.ViewerCreated.TotalCount > 0 {
|
||||
printPrs(out, prPayload.ViewerCreated.PullRequests...)
|
||||
printPrs(out, prPayload.ViewerCreated.TotalCount, prPayload.ViewerCreated.PullRequests...)
|
||||
} else {
|
||||
printMessage(out, " You have no open pull requests")
|
||||
}
|
||||
|
|
@ -118,7 +116,7 @@ func prStatus(cmd *cobra.Command, args []string) error {
|
|||
|
||||
printHeader(out, "Requesting a code review from you")
|
||||
if prPayload.ReviewRequested.TotalCount > 0 {
|
||||
printPrs(out, prPayload.ReviewRequested.PullRequests...)
|
||||
printPrs(out, prPayload.ReviewRequested.TotalCount, prPayload.ReviewRequested.PullRequests...)
|
||||
} else {
|
||||
printMessage(out, " You have no pull requests to review")
|
||||
}
|
||||
|
|
@ -437,7 +435,7 @@ func prCheckout(cmd *cobra.Command, args []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func printPrs(w io.Writer, prs ...api.PullRequest) {
|
||||
func printPrs(w io.Writer, totalCount int, prs ...api.PullRequest) {
|
||||
for _, pr := range prs {
|
||||
prNumber := fmt.Sprintf("#%d", pr.Number)
|
||||
fmt.Fprintf(w, " %s %s %s", utils.Green(prNumber), truncate(50, replaceExcessiveWhitespace(pr.Title)), utils.Cyan("["+pr.HeadLabel()+"]"))
|
||||
|
|
@ -474,6 +472,10 @@ func printPrs(w io.Writer, prs ...api.PullRequest) {
|
|||
|
||||
fmt.Fprint(w, "\n")
|
||||
}
|
||||
remaining := totalCount - len(prs)
|
||||
if remaining > 0 {
|
||||
fmt.Fprintf(w, utils.Gray(" And %d more\n"), remaining)
|
||||
}
|
||||
}
|
||||
|
||||
func printHeader(w io.Writer, s string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue