a73x

6ab6d4c4

Display close reason in issue show and TUI dashboard

a73x   2026-03-20 20:10

Closes e0383643. IssueState now tracks close_reason from IssueClose
events and displays it in both the CLI 'issue show' output and the
TUI dashboard issue detail view.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

diff --git a/src/issue.rs b/src/issue.rs
index e9fb09e..2e5335d 100644
--- a/src/issue.rs
+++ b/src/issue.rs
@@ -59,6 +59,9 @@ pub fn show(repo: &Repository, id_prefix: &str) -> Result<(), crate::error::Erro
    println!("Title: {}", issue.title);
    println!("Author: {} <{}>", issue.author.name, issue.author.email);
    println!("Created: {}", issue.created_at);
    if let Some(ref reason) = issue.close_reason {
        println!("Closed:  {}", reason);
    }
    if !issue.body.is_empty() {
        println!("\n{}", issue.body);
    }
diff --git a/src/state.rs b/src/state.rs
index c70a6d4..f1a374e 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -24,6 +24,7 @@ pub struct IssueState {
    pub title: String,
    pub body: String,
    pub status: IssueStatus,
    pub close_reason: Option<String>,
    pub comments: Vec<Comment>,
    pub created_at: String,
    pub author: Author,
@@ -81,6 +82,7 @@ impl IssueState {
                        title,
                        body,
                        status: IssueStatus::Open,
                        close_reason: None,
                        comments: Vec::new(),
                        created_at: event.timestamp.clone(),
                        author: event.author.clone(),
@@ -96,10 +98,11 @@ impl IssueState {
                        });
                    }
                }
                Action::IssueClose { .. } => {
                Action::IssueClose { reason } => {
                    if let Some(ref mut s) = state {
                        if status_ts.as_ref().is_none_or(|ts| event.timestamp >= *ts) {
                            s.status = IssueStatus::Closed;
                            s.close_reason = reason;
                            status_ts = Some(event.timestamp.clone());
                        }
                    }
diff --git a/src/tui.rs b/src/tui.rs
index 899c67b..51612da 100644
--- a/src/tui.rs
+++ b/src/tui.rs
@@ -523,6 +523,13 @@ fn build_issue_detail(issue: &IssueState) -> Text<'static> {
        ]),
    ];

    if let Some(ref reason) = issue.close_reason {
        lines.push(Line::from(vec![
            Span::styled("Closed:  ", Style::default().fg(Color::Red)),
            Span::raw(reason.clone()),
        ]));
    }

    if !issue.body.is_empty() {
        lines.push(Line::raw(""));
        for l in issue.body.lines() {