From ba0862f5a6d8f59395b5fab2a573118ab8ed4c4e Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Sun, 6 Jul 2025 00:18:36 -0600 Subject: [PATCH] add `ent edit` --- src/bin/ent/main.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/bin/ent/main.rs b/src/bin/ent/main.rs index e0dca3c..3d6f80b 100644 --- a/src/bin/ent/main.rs +++ b/src/bin/ent/main.rs @@ -23,6 +23,9 @@ enum Commands { /// Create a new issue. New { description: Option }, + + /// Edit the description of an issue. + Edit { issue_id: String }, } fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<()> { @@ -46,6 +49,18 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<( issue.edit_description()?; println!("created new issue '{}'", issue.title()); } + Commands::Edit { issue_id } => { + let mut issues = + entomologist::issues::Issues::new_from_dir(std::path::Path::new(issues_dir))?; + match issues.issues.get_mut(issue_id) { + Some(issue) => { + issue.edit_description()?; + } + None => { + println!("issue {} not found", issue_id); + } + } + } } Ok(())