Show file magic in --info, currently uses the file command
This commit is contained in:
13
src/main.rs
13
src/main.rs
@@ -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(" "))
|
||||
|
||||
Reference in New Issue
Block a user