diff options
| author | Ellie Huxtable <e@elm.sh> | 2021-02-14 22:12:35 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-14 22:12:35 +0000 |
| commit | 851285225fce83bd63410d44e106df0c2a4a4733 (patch) | |
| tree | 943681c16d49a464dbc1ac80441a37572c271b47 /src/command/import.rs | |
| parent | zsh bin is sometimes /usr/bin/zsh or might be elsewhere too (#8) (diff) | |
| download | atuin-851285225fce83bd63410d44e106df0c2a4a4733.zip | |
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
Diffstat (limited to '')
| -rw-r--r-- | src/command/import.rs | 15 |
1 files changed, 5 insertions, 10 deletions
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::<History>::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)?; |
