(opts *ViewOptions, baseRepo ghrepo.Interface, pr *api.PullRequest)
| 203 | } |
| 204 | |
| 205 | func printHumanPrPreview(opts *ViewOptions, baseRepo ghrepo.Interface, pr *api.PullRequest) error { |
| 206 | out := opts.IO.Out |
| 207 | cs := opts.IO.ColorScheme() |
| 208 | |
| 209 | // Header (Title and State) |
| 210 | fmt.Fprintf(out, "%s %s#%d\n", cs.Bold(pr.Title), ghrepo.FullName(baseRepo), pr.Number) |
| 211 | fmt.Fprintf(out, |
| 212 | "%s • %s wants to merge %s into %s from %s • %s\n", |
| 213 | shared.StateTitleWithColor(cs, *pr), |
| 214 | pr.Author.DisplayName(), |
| 215 | text.Pluralize(pr.Commits.TotalCount, "commit"), |
| 216 | pr.BaseRefName, |
| 217 | pr.HeadRefName, |
| 218 | text.FuzzyAgo(opts.Now(), pr.CreatedAt), |
| 219 | ) |
| 220 | |
| 221 | // added/removed |
| 222 | fmt.Fprintf(out, |
| 223 | "%s %s", |
| 224 | cs.Green("+"+strconv.Itoa(pr.Additions)), |
| 225 | cs.Red("-"+strconv.Itoa(pr.Deletions)), |
| 226 | ) |
| 227 | |
| 228 | // checks |
| 229 | checks := pr.ChecksStatus() |
| 230 | if summary := shared.PrCheckStatusSummaryWithColor(cs, checks); summary != "" { |
| 231 | fmt.Fprintf(out, " • %s\n", summary) |
| 232 | } else { |
| 233 | fmt.Fprintln(out) |
| 234 | } |
| 235 | |
| 236 | // Reactions |
| 237 | if reactions := shared.ReactionGroupList(pr.ReactionGroups); reactions != "" { |
| 238 | fmt.Fprint(out, reactions) |
| 239 | fmt.Fprintln(out) |
| 240 | } |
| 241 | |
| 242 | // Metadata |
| 243 | if reviewers := prReviewerList(*pr, cs); reviewers != "" { |
| 244 | fmt.Fprint(out, cs.Bold("Reviewers: ")) |
| 245 | fmt.Fprintln(out, reviewers) |
| 246 | } |
| 247 | if assignees := prAssigneeList(*pr); assignees != "" { |
| 248 | fmt.Fprint(out, cs.Bold("Assignees: ")) |
| 249 | fmt.Fprintln(out, assignees) |
| 250 | } |
| 251 | if labels := prLabelList(*pr, cs); labels != "" { |
| 252 | fmt.Fprint(out, cs.Bold("Labels: ")) |
| 253 | fmt.Fprintln(out, labels) |
| 254 | } |
| 255 | if projects := prProjectList(*pr); projects != "" { |
| 256 | fmt.Fprint(out, cs.Bold("Projects: ")) |
| 257 | fmt.Fprintln(out, projects) |
| 258 | } |
| 259 | if pr.Milestone != nil { |
| 260 | fmt.Fprint(out, cs.Bold("Milestone: ")) |
| 261 | fmt.Fprintln(out, pr.Milestone.Title) |
| 262 | } |
no test coverage detected