From 156893d774b4da5b541fdbb08428f9ec392949a0 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Sun, 25 Apr 2021 18:21:52 +0100 Subject: Update docs, unify on SQLx, bugfixes (#40) * Begin moving to sqlx for local too * Stupid scanners should just have a nice cup of tea Random internet shit searching for /.env or whatever * Remove diesel and rusqlite fully --- src/command/import.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/command/import.rs') diff --git a/src/command/import.rs b/src/command/import.rs index 56fb30a7..931e7af4 100644 --- a/src/command/import.rs +++ b/src/command/import.rs @@ -26,7 +26,7 @@ pub enum Cmd { } impl Cmd { - pub fn run(&self, db: &mut impl Database) -> Result<()> { + pub async fn run(&self, db: &mut (impl Database + Send + Sync)) -> Result<()> { println!(" A'Tuin "); println!("======================"); println!(" \u{1f30d} "); @@ -41,19 +41,19 @@ impl Cmd { if shell.ends_with("/zsh") { println!("Detected ZSH"); - import_zsh(db) + import_zsh(db).await } else { println!("cannot import {} history", shell); Ok(()) } } - Self::Zsh => import_zsh(db), + Self::Zsh => import_zsh(db).await, } } } -fn import_zsh(db: &mut impl Database) -> Result<()> { +async fn import_zsh(db: &mut (impl Database + Send + Sync)) -> Result<()> { // oh-my-zsh sets HISTFILE=~/.zhistory // zsh has no default value for this var, but uses ~/.zhistory. // we could maybe be smarter about this in the future :) @@ -103,7 +103,7 @@ fn import_zsh(db: &mut impl Database) -> Result<()> { buf.push(i); if buf.len() == buf_size { - db.save_bulk(&buf)?; + db.save_bulk(&buf).await?; progress.inc(buf.len() as u64); buf.clear(); @@ -111,7 +111,7 @@ fn import_zsh(db: &mut impl Database) -> Result<()> { } if !buf.is_empty() { - db.save_bulk(&buf)?; + db.save_bulk(&buf).await?; progress.inc(buf.len() as u64); } -- cgit v1.3.1