fix: broken edit.rs

This commit is contained in:
2026-11-22 01:47:20 +01:00
parent b4941442cd
commit d0014711c8
+10 -3
View File
@@ -10,7 +10,7 @@ use std::io::Write;
use std::path::PathBuf;
use std::{fs::File, fs::read_dir, io::Read, process::Command};
pub fn edit(file_path: Vec<PathBuf>, extra_files: [String; 9]) -> std::io::Result<()> {
pub fn edit(file_path: Vec<PathBuf>, extra_files: &[String]) -> std::io::Result<()> {
let tmp_file_path = PathBuf::from("/tmp/keks-sort-metadata");
let mut tmp_file = File::create(&tmp_file_path)?;
let editor = var("EDITOR").unwrap();
@@ -34,17 +34,24 @@ pub fn edit(file_path: Vec<PathBuf>, extra_files: [String; 9]) -> std::io::Resul
continue;
}
let tag = crate::get_metadata(&path);
let tag = match crate::get_metadata(&path) {
Ok(tag) => tag,
Err(err) => {
eprintln!("Failed to get metadata for {:?}: {}", path, err);
continue;
}
};
files.push(FileMetadata { path, tag });
}
} else {
let tag = &crate::get_metadata(file);
if let Ok(tag) = crate::get_metadata(file) {
files.push(FileMetadata {
path: file.to_path_buf(),
tag: tag.clone(),
});
}
}
}
for file in &files {
let mut items: Vec<_> = file.tag.items().collect();