Skip to content

Commit 58be083

Browse files
committed
Remove and commands as serve does that in background.
1 parent 59e4630 commit 58be083

1 file changed

Lines changed: 1 addition & 52 deletions

File tree

src/main.rs

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -220,58 +220,6 @@ fn entry() -> Result<(), ()> {
220220
})?;
221221

222222
match subcommand.as_str() {
223-
/*
224-
"reindex" => {
225-
assert!(!use_sqlite_mode, "The sqlite model is deprecated");
226-
let dir_path = args.next().ok_or_else(|| {
227-
usage(&program);
228-
eprintln!("ERROR: no directory is provided for {subcommand} subcommand");
229-
})?;
230-
231-
let index_path = "index.json";
232-
let index_file = File::open(&index_path).map_err(|err| {
233-
eprintln!("ERROR: could not open index file {index_path}: {err}");
234-
})?;
235-
let mut model: InMemoryModel = serde_json::from_reader(index_file).map_err(|err| {
236-
eprintln!("ERROR: could not parse index file {index_path}: {err}");
237-
})?;
238-
239-
append_folder_to_model(Path::new(&dir_path), &mut model)?;
240-
save_model_as_json(&model, index_path)?;
241-
return Ok(());
242-
}
243-
244-
"index" => {
245-
let dir_path = args.next().ok_or_else(|| {
246-
usage(&program);
247-
eprintln!("{}: No directory path is provided for {} subcommand.", "ERROR".bold().red(), subcommand.bold().bright_blue());
248-
})?;
249-
250-
if use_sqlite_mode {
251-
let index_path = "index.db";
252-
253-
// Remove previous index.db to update
254-
if Path::exists(Path::new(index_path)) {
255-
if let Err(err) = fs::remove_file(index_path) {
256-
eprintln!("{}: Could not delete file {path} as \"{err}\"", "ERROR".bold().red(), path = index_path.bold().bright_blue(), err = err.to_string().red());
257-
return Err(());
258-
}
259-
}
260-
261-
let mut model = SqliteModel::open(Path::new(index_path)).unwrap();
262-
model.begin()?;
263-
append_folder_to_model(Path::new(&dir_path), &mut model)?;
264-
model.commit()?;
265-
266-
} else {
267-
let index_path = "index.json";
268-
let mut model = Default::default();
269-
append_folder_to_model(Path::new(&dir_path), &mut model)?;
270-
save_model_as_json(&model, index_path)?;
271-
}
272-
}
273-
*/
274-
275223
"search" => {
276224
assert!(!use_sqlite_mode, "Sqlite mode is DEPRACATED.");
277225
let index_path = args.next().ok_or_else(|| {
@@ -347,6 +295,7 @@ fn entry() -> Result<(), ()> {
347295
let model= model.lock().unwrap();
348296
save_model_as_json(&model, index_path).unwrap();
349297
}
298+
println!("{}: Finished indexing ...", "INFO".cyan());
350299
});
351300
}
352301
return server::start(&address, Arc::clone(&model));

0 commit comments

Comments
 (0)