Simplify error handling in cli module
This commit is contained in:
parent
371c86f10f
commit
82affe39a1
7 changed files with 72 additions and 67 deletions
|
|
@ -74,13 +74,13 @@ fn show_log(files: &Files, log: Sourced<'_, Log>) {
|
|||
|
||||
fn show_ident(files: &Files, entries: &[Entry], layout: &LineLayout, ident: Ident) {
|
||||
match ident {
|
||||
Ident::Number(n) => match layout.look_up_number::<()>(n) {
|
||||
Ident::Number(n) => match layout.look_up_number(n) {
|
||||
Ok(index) => show_entry(files, &entries[index]),
|
||||
Err(e) => println!("{}", e),
|
||||
},
|
||||
Ident::Date(date) => match files.log(date) {
|
||||
Some(log) => show_log(files, log),
|
||||
None => println!("{}", Error::NoSuchLog::<()>(date)),
|
||||
None => println!("{}", Error::NoSuchLog(date)),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue