(opts *ViewOptions, baseRepo ghrepo.Interface, issue *api.Issue)
| 238 | } |
| 239 | |
| 240 | func printHumanIssuePreview(opts *ViewOptions, baseRepo ghrepo.Interface, issue *api.Issue) error { |
| 241 | out := opts.IO.Out |
| 242 | cs := opts.IO.ColorScheme() |
| 243 | |
| 244 | // Header (Title and State) |
| 245 | fmt.Fprintf(out, "%s %s#%d\n", cs.Bold(issue.Title), ghrepo.FullName(baseRepo), issue.Number) |
| 246 | |
| 247 | // State line - include issue type prefix when present |
| 248 | stateLine := issueStateTitleWithColor(cs, issue) |
| 249 | if issue.IssueType != nil { |
| 250 | stateLine = cs.Muted(issue.IssueType.Name) + " · " + stateLine |
| 251 | } |
| 252 | fmt.Fprintf(out, |
| 253 | "%s • %s opened %s • %s\n", |
| 254 | stateLine, |
| 255 | issue.Author.DisplayName(), |
| 256 | text.FuzzyAgo(opts.Now(), issue.CreatedAt), |
| 257 | text.Pluralize(issue.Comments.TotalCount, "comment"), |
| 258 | ) |
| 259 | |
| 260 | // Reactions |
| 261 | if reactions := prShared.ReactionGroupList(issue.ReactionGroups); reactions != "" { |
| 262 | fmt.Fprint(out, reactions) |
| 263 | fmt.Fprintln(out) |
| 264 | } |
| 265 | |
| 266 | // Metadata |
| 267 | if assignees := issueAssigneeList(*issue); assignees != "" { |
| 268 | fmt.Fprint(out, cs.Bold("Assignees: ")) |
| 269 | fmt.Fprintln(out, assignees) |
| 270 | } |
| 271 | if labels := issueLabelList(issue, cs); labels != "" { |
| 272 | fmt.Fprint(out, cs.Bold("Labels: ")) |
| 273 | fmt.Fprintln(out, labels) |
| 274 | } |
| 275 | if issue.IssueType != nil { |
| 276 | fmt.Fprint(out, cs.Bold("Type: ")) |
| 277 | fmt.Fprintln(out, issue.IssueType.Name) |
| 278 | } |
| 279 | if issue.Parent != nil { |
| 280 | fmt.Fprint(out, cs.Bold("Parent: ")) |
| 281 | fmt.Fprintln(out, formatLinkedIssueRef(issue.Parent)+" "+issue.Parent.Title) |
| 282 | } |
| 283 | if blockedBy := formatLinkedIssueListWithTitle(issue.BlockedBy.Nodes); blockedBy != "" { |
| 284 | fmt.Fprint(out, cs.Bold("Blocked by: ")) |
| 285 | fmt.Fprintln(out, blockedBy) |
| 286 | } |
| 287 | if blocking := formatLinkedIssueListWithTitle(issue.Blocking.Nodes); blocking != "" { |
| 288 | fmt.Fprint(out, cs.Bold("Blocking: ")) |
| 289 | fmt.Fprintln(out, blocking) |
| 290 | } |
| 291 | if projects := issueProjectList(*issue); projects != "" { |
| 292 | fmt.Fprint(out, cs.Bold("Projects: ")) |
| 293 | fmt.Fprintln(out, projects) |
| 294 | } |
| 295 | if issue.Milestone != nil { |
| 296 | fmt.Fprint(out, cs.Bold("Milestone: ")) |
| 297 | fmt.Fprintln(out, issue.Milestone.Title) |
no test coverage detected