mirror of
https://github.com/PR0M3TH3AN/Marlin.git
synced 2025-09-08 23:28:44 +00:00
update
This commit is contained in:
@@ -52,16 +52,15 @@ fn main() -> Result<()> {
|
|||||||
/* ── open DB (runs migrations) ───────────────────────────── */
|
/* ── open DB (runs migrations) ───────────────────────────── */
|
||||||
let mut conn = db::open(&cfg.db_path)?;
|
let mut conn = db::open(&cfg.db_path)?;
|
||||||
|
|
||||||
/* ── command dispatch ────────────────────────────────────── */
|
/* ── command dispatch ────────────────────────────────────── */
|
||||||
match args.command {
|
match args.command {
|
||||||
Commands::Completions { .. } => {} // handled above
|
Commands::Completions { .. } => {} // handled above
|
||||||
|
|
||||||
/* ---- init ------------------------------------------------ */
|
/* ---- init ------------------------------------------------ */
|
||||||
Commands::Init => {
|
Commands::Init => {
|
||||||
info!("Database initialised at {}", cfg.db_path.display());
|
info!("Database initialised at {}", cfg.db_path.display());
|
||||||
let cwd = env::current_dir().context("getting current directory")?;
|
let cwd = env::current_dir().context("getting current directory")?;
|
||||||
let count =
|
let count = scan::scan_directory(&mut conn, &cwd).context("initial scan failed")?;
|
||||||
scan::scan_directory(&mut conn, &cwd).context("initial scan failed")?;
|
|
||||||
info!("Initial scan complete – indexed/updated {count} files");
|
info!("Initial scan complete – indexed/updated {count} files");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,11 +75,8 @@ match args.command {
|
|||||||
if dirty {
|
if dirty {
|
||||||
let dirty_ids = take_dirty(&conn)?;
|
let dirty_ids = take_dirty(&conn)?;
|
||||||
for id in dirty_ids {
|
for id in dirty_ids {
|
||||||
let path: String = conn.query_row(
|
let path: String =
|
||||||
"SELECT path FROM files WHERE id = ?1",
|
conn.query_row("SELECT path FROM files WHERE id = ?1", [id], |r| r.get(0))?;
|
||||||
[id],
|
|
||||||
|r| r.get(0),
|
|
||||||
)?;
|
|
||||||
scan::scan_directory(&mut conn, Path::new(&path))?;
|
scan::scan_directory(&mut conn, Path::new(&path))?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -152,9 +148,10 @@ match args.command {
|
|||||||
Commands::Version(v_cmd) => cli::version::run(&v_cmd, &mut conn, args.format)?,
|
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::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)?,
|
Commands::Watch(watch_cmd) => cli::watch::run(&watch_cmd, &mut conn, args.format)?,
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/* ─────────────────── helpers & sub-routines ─────────────────── */
|
/* ─────────────────── helpers & sub-routines ─────────────────── */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user