From 851285225fce83bd63410d44e106df0c2a4a4733 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Sun, 14 Feb 2021 22:12:35 +0000 Subject: Add stats command (#9) * Add stats command For example atuin stats day yesterday atuin stats day last friday atuin stats day 01/01/21 * Output tables, fix import blanks --- src/command/import.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/command/import.rs') diff --git a/src/command/import.rs b/src/command/import.rs index 5a91b6b7..88108400 100644 --- a/src/command/import.rs +++ b/src/command/import.rs @@ -96,16 +96,11 @@ fn import_zsh(db: &mut Sqlite) -> Result<()> { let buf_size = 100; let mut buf = Vec::::with_capacity(buf_size); - for i in zsh { - match i { - Ok(h) => { - buf.push(h); - } - Err(e) => { - error!("{}", e); - continue; - } - } + for i in zsh + .filter_map(Result::ok) + .filter(|x| !x.command.trim().is_empty()) + { + buf.push(i); if buf.len() == buf_size { db.save_bulk(&buf)?; -- cgit v1.3.1