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