From acf539c683a6545bd01f866bed0c82fd0fa33efb Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Wed, 9 Jul 2025 22:11:27 -0600 Subject: [PATCH] handle user abort in `ent comment` The user saving an empty description is a normal user-initiated abort, not an error. --- src/bin/ent/main.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/bin/ent/main.rs b/src/bin/ent/main.rs index fa18b2a..893534b 100644 --- a/src/bin/ent/main.rs +++ b/src/bin/ent/main.rs @@ -234,12 +234,20 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<( return Err(anyhow::anyhow!("issue {} not found", issue_id)); }; let mut comment = issue.new_comment()?; - match description { - Some(description) => { - comment.set_description(description)?; + let r = match description { + Some(description) => comment.set_description(description), + None => comment.edit_description(), + }; + match r { + Err(entomologist::comment::CommentError::EmptyDescription) => { + println!("aborted new comment"); + return Ok(()); } - None => { - comment.edit_description()?; + Err(e) => { + return Err(e.into()); + } + Ok(()) => { + println!("created new comment {}", &comment.uuid); } } }