This commit is contained in:
thePR0M3TH3AN
2025-05-21 20:14:56 -04:00
parent 2a388e980f
commit 99f72af4bc

View File

@@ -52,16 +52,15 @@ fn main() -> Result<()> {
/* ── open DB (runs migrations) ───────────────────────────── */
let mut conn = db::open(&cfg.db_path)?;
/* ── command dispatch ────────────────────────────────────── */
match args.command {
/* ── command dispatch ────────────────────────────────────── */
match args.command {
Commands::Completions { .. } => {} // handled above
/* ---- init ------------------------------------------------ */
Commands::Init => {
info!("Database initialised at {}", cfg.db_path.display());
let cwd = env::current_dir().context("getting current directory")?;
let count =
scan::scan_directory(&mut conn, &cwd).context("initial scan failed")?;
let count = scan::scan_directory(&mut conn, &cwd).context("initial scan failed")?;
info!("Initial scan complete indexed/updated {count} files");
}
@@ -76,11 +75,8 @@ match args.command {
if dirty {
let dirty_ids = take_dirty(&conn)?;
for id in dirty_ids {
let path: String = conn.query_row(
"SELECT path FROM files WHERE id = ?1",
[id],
|r| r.get(0),
)?;
let path: String =
conn.query_row("SELECT path FROM files WHERE id = ?1", [id], |r| r.get(0))?;
scan::scan_directory(&mut conn, Path::new(&path))?;
}
} else {
@@ -152,9 +148,10 @@ match args.command {
Commands::Version(v_cmd) => cli::version::run(&v_cmd, &mut conn, args.format)?,
Commands::Event(e_cmd) => cli::event::run(&e_cmd, &mut conn, args.format)?,
Commands::Watch(watch_cmd) => cli::watch::run(&watch_cmd, &mut conn, args.format)?,
}
}
Ok(())
Ok(())
}
/* ─────────────────── helpers & sub-routines ─────────────────── */