refactor: remove magic function and related code
This commit is contained in:
@@ -120,25 +120,6 @@ fn show_item(
|
||||
file_size_cell,
|
||||
]));
|
||||
|
||||
// Corrected logic for file_magic_cell:
|
||||
// compression_type_val is already the successfully parsed CompressionType.
|
||||
// The .expect() here will panic if get_compression_engine returns an Err.
|
||||
let compression_engine = get_compression_engine(compression_type_val.clone())
|
||||
.expect("Unable to get compression engine");
|
||||
let magic_result = compression_engine.magic(item_path_buf.clone()); // Use cloned item_path_buf
|
||||
|
||||
let file_magic_cell = match magic_result {
|
||||
Ok(magic_str) => Cell::new(magic_str.as_str()),
|
||||
Err(e) => Cell::new(&e.to_string())
|
||||
.with_style(Attr::ForegroundColor(prettytable::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