simplify ent new
This commit is contained in:
parent
acf539c683
commit
e09e4b9cb7
1 changed files with 17 additions and 11 deletions
|
|
@ -132,18 +132,24 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Commands::New {
|
Commands::New { description } => {
|
||||||
description: Some(description),
|
|
||||||
} => {
|
|
||||||
let mut issue = entomologist::issue::Issue::new(issues_dir)?;
|
let mut issue = entomologist::issue::Issue::new(issues_dir)?;
|
||||||
issue.set_description(description)?;
|
let r = match description {
|
||||||
println!("created new issue '{}'", issue.title());
|
Some(description) => issue.set_description(description),
|
||||||
}
|
None => issue.edit_description(),
|
||||||
|
};
|
||||||
Commands::New { description: None } => {
|
match r {
|
||||||
let mut issue = entomologist::issue::Issue::new(issues_dir)?;
|
Err(entomologist::issue::IssueError::EmptyDescription) => {
|
||||||
issue.edit_description()?;
|
println!("no new issue created");
|
||||||
println!("created new issue '{}'", issue.title());
|
return Ok(());
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
return Err(e.into());
|
||||||
|
}
|
||||||
|
Ok(()) => {
|
||||||
|
println!("created new issue '{}'", issue.title());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Commands::Edit { issue_id } => {
|
Commands::Edit { issue_id } => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue