diff --git a/src/bin/ent/main.rs b/src/bin/ent/main.rs index 7c0bf82..0498a08 100644 --- a/src/bin/ent/main.rs +++ b/src/bin/ent/main.rs @@ -43,6 +43,7 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<( println!("{} {} ({:?})", uuid, issue.title(), issue.state); } } + Commands::New { description: Some(description), } => { @@ -50,11 +51,13 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<( issue.set_description(description)?; println!("created new issue '{}'", issue.title()); } + Commands::New { description: None } => { let mut issue = entomologist::issue::Issue::new(issues_dir)?; 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))?; @@ -63,10 +66,11 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<( issue.edit_description()?; } None => { - println!("issue {} not found", issue_id); + return Err(anyhow::anyhow!("issue {} not found", issue_id)); } } } + Commands::Show { issue_id } => { let issues = entomologist::issues::Issues::new_from_dir(std::path::Path::new(issues_dir))?; @@ -81,7 +85,7 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<( println!("{}", issue.description); } None => { - println!("issue {} not found", issue_id); + return Err(anyhow::anyhow!("issue {} not found", issue_id)); } } }