Show file magic in --info, currently uses the file command

This commit is contained in:
Andrew Phillips
2024-02-28 19:20:30 +00:00
parent 982f74f27b
commit ae9ea3ec03
2 changed files with 47 additions and 1 deletions

View File

@@ -740,6 +740,19 @@ fn mode_info(cmd: &mut Command, args: Args, ids: &mut Vec<i64>, tags: &mut Vec<S
file_size_cell
]));
let compression_engine = compression::get_engine(compression_type).expect("Unable to get compression engine");
let magic = compression_engine.magic(item_path.clone());
let file_magic_cell = match magic {
Ok(magic) => Cell::new(magic.as_str()),
Err(e) => Cell::new(&e.to_string()).with_style(Attr::ForegroundColor(color::RED)).with_style(Attr::Bold)
};
table.add_row(Row::new(vec![
Cell::new("File Magic").with_style(Attr::Bold),
file_magic_cell
]));
table.add_row(Row::new(vec![
Cell::new("Tags").with_style(Attr::Bold),
Cell::new(&item_tags.join(" "))