Compact one-line summary for list view, with date and key metadata.
(issue: dict)
| 180 | |
| 181 | |
| 182 | def format_list_line(issue: dict) -> str: |
| 183 | """Compact one-line summary for list view, with date and key metadata.""" |
| 184 | labels = ", ".join(issue["labels"][:3]) if issue["labels"] else "-" |
| 185 | thumbs = issue["reactions"].get("THUMBS_UP", 0) |
| 186 | prs = [ |
| 187 | t |
| 188 | for t in issue["timeline"] |
| 189 | if t["type"] == "CrossReferencedEvent" |
| 190 | and t.get("source_type") == "PullRequest" |
| 191 | and t.get("source_state") == "OPEN" |
| 192 | ] |
| 193 | pr_marker = f" PR#{prs[0]['source_number']}" if prs else "" |
| 194 | return ( |
| 195 | f"#{issue['number']:<5d} {issue['updated_at'][:10]} " |
| 196 | f"[{labels}] {issue['comment_count']}c {thumbs}\u2191" |
| 197 | f"{pr_marker} {issue['title'][:70]}" |
| 198 | ) |
| 199 | |
| 200 | |
| 201 | def format_detail(issue: dict, brief: bool = False) -> str: |