feat: add digest type and value to info output

This commit is contained in:
Andrew Phillips (aider)
2025-05-13 17:55:48 -03:00
parent cf279c42f1
commit 485b36ce02

View File

@@ -108,15 +108,22 @@ pub fn mode_info(
file_size_cell, file_size_cell,
])); ]));
let file_magic_cell = match compression_type {
Ok(compression_type) => {
let compression_engine = let compression_engine =
get_compression_engine(compression_type).expect("Unable to get compression engine"); get_compression_engine(compression_type).expect("Unable to get compression engine");
let magic = compression_engine.magic(item_path.clone()); let magic = compression_engine.magic(item_path.clone());
let file_magic_cell = match magic { match magic {
Ok(magic) => Cell::new(magic.as_str()), Ok(magic) => Cell::new(magic.as_str()),
Err(e) => Cell::new(&e.to_string()) Err(e) => Cell::new(&e.to_string())
.with_style(Attr::ForegroundColor(prettytable::color::RED)) .with_style(Attr::ForegroundColor(prettytable::color::RED))
.with_style(Attr::Bold), .with_style(Attr::Bold),
}
},
Err(e) => Cell::new(&e.to_string())
.with_style(Attr::ForegroundColor(prettytable::color::RED))
.with_style(Attr::Bold),
}; };
table.add_row(Row::new(vec![ table.add_row(Row::new(vec![
@@ -129,6 +136,20 @@ pub fn mode_info(
Cell::new(&item_tags.join(" ")), Cell::new(&item_tags.join(" ")),
])); ]));
if let Some(digest_type) = &item.digest_type {
table.add_row(Row::new(vec![
Cell::new("Digest Type").with_style(Attr::Bold),
Cell::new(digest_type),
]));
}
if let Some(digest_value) = &item.digest_value {
table.add_row(Row::new(vec![
Cell::new("Digest Value").with_style(Attr::Bold),
Cell::new(digest_value),
]));
}
for meta in crate::db::get_item_meta(conn, &item)? { for meta in crate::db::get_item_meta(conn, &item)? {
let meta_name = format!("Meta: {}", &meta.name); let meta_name = format!("Meta: {}", &meta.name);
table.add_row(Row::new(vec![ table.add_row(Row::new(vec![