ent show: simplify logic
This simplifies the code flow and gets rid of two levels of indentation.
This commit is contained in:
parent
6a1e438c94
commit
0d9a893087
1 changed files with 25 additions and 29 deletions
|
|
@ -285,8 +285,9 @@ fn handle_command(
|
|||
|
||||
Commands::Show { issue_id } => {
|
||||
let issues = entomologist::database::read_issues_database(issues_database_source)?;
|
||||
match issues.get_issue(issue_id) {
|
||||
Some(issue) => {
|
||||
let Some(issue) = issues.get_issue(issue_id) else {
|
||||
return Err(anyhow::anyhow!("issue {} not found", issue_id));
|
||||
};
|
||||
println!("issue {}", issue_id);
|
||||
println!("author: {}", issue.author);
|
||||
println!("creation_time: {}", issue.creation_time);
|
||||
|
|
@ -311,11 +312,6 @@ fn handle_command(
|
|||
println!("{}", comment.description);
|
||||
}
|
||||
}
|
||||
None => {
|
||||
return Err(anyhow::anyhow!("issue {} not found", issue_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Commands::State {
|
||||
issue_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue