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