use std::collections::HashMap;
use std::fs;
use std::io::{self, BufRead};
use std::path::Path;
pub fn read_index(path: &Path) -> io::Result<HashMap<String, String>> {
let mut entries = HashMap::new();
let file = fs::File::open(path)?;
for line in io::BufReader::new(file).lines() {
let line = line?;
let parts: Vec<&str> = line.splitn(2, ' ').collect();
if parts.len() == 2 {
entries.insert(parts[1].to_string(), parts[0].to_string());
}
}
Ok(entries)
}