Skip to content

Commit e1f52fe

Browse files
committed
Display checks, reviews on a new line to prevent terminal wrap
1 parent 7419f7a commit e1f52fe

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

command/pr.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,14 @@ func prView(cmd *cobra.Command, args []string) error {
249249
func printPrs(prs ...api.PullRequest) {
250250
for _, pr := range prs {
251251
fmt.Printf(" #%d %s %s", pr.Number, truncate(50, pr.Title), utils.Cyan("["+pr.HeadRefName+"]"))
252-
if checks := pr.ChecksStatus(); checks.Total > 0 {
252+
253+
checks := pr.ChecksStatus()
254+
reviews := pr.ReviewStatus()
255+
if checks.Total > 0 || reviews.ChangesRequested || reviews.Approved {
256+
fmt.Printf("\n ")
257+
}
258+
259+
if checks.Total > 0 {
253260
ratio := fmt.Sprintf("%d/%d", checks.Passing, checks.Total)
254261
if checks.Failing > 0 {
255262
ratio = utils.Red(ratio)
@@ -260,12 +267,13 @@ func printPrs(prs ...api.PullRequest) {
260267
}
261268
fmt.Printf(" - checks: %s", ratio)
262269
}
263-
reviews := pr.ReviewStatus()
270+
264271
if reviews.ChangesRequested {
265272
fmt.Printf(" - %s", utils.Red("changes requested"))
266273
} else if reviews.Approved {
267274
fmt.Printf(" - %s", utils.Green("approved"))
268275
}
276+
269277
fmt.Printf("\n")
270278
}
271279
}

0 commit comments

Comments
 (0)