refactor: remove digest type and value handling
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
a8c363333c
commit
91cceff3e8
@@ -63,8 +63,6 @@ pub enum ColumnType {
|
|||||||
Time,
|
Time,
|
||||||
Size,
|
Size,
|
||||||
Compression,
|
Compression,
|
||||||
DigestType,
|
|
||||||
DigestValue,
|
|
||||||
FileSize,
|
FileSize,
|
||||||
FilePath,
|
FilePath,
|
||||||
Tags,
|
Tags,
|
||||||
|
|||||||
@@ -144,28 +144,6 @@ fn show_item(
|
|||||||
Cell::new(&item_tags.join(" ")),
|
Cell::new(&item_tags.join(" ")),
|
||||||
]));
|
]));
|
||||||
|
|
||||||
// Corrected logic for item.digest_type: String
|
|
||||||
// Assuming you want to display it only if it's not empty.
|
|
||||||
let digest_type_string_val = item.digest_type.clone();
|
|
||||||
if !digest_type_string_val.is_empty() {
|
|
||||||
table.add_row(Row::new(vec![
|
|
||||||
Cell::new("Digest Type").with_style(Attr::Bold),
|
|
||||||
Cell::new(&digest_type_string_val),
|
|
||||||
]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Correct logic for item.digest_value: Option<String>
|
|
||||||
let digest_value_opt = item.digest_value.clone();
|
|
||||||
match digest_value_opt {
|
|
||||||
Some(dv_str) => {
|
|
||||||
table.add_row(Row::new(vec![
|
|
||||||
Cell::new("Digest Value").with_style(Attr::Bold),
|
|
||||||
Cell::new(&dv_str),
|
|
||||||
]));
|
|
||||||
}
|
|
||||||
None => { /* Do nothing if None, as per original logic */ }
|
|
||||||
}
|
|
||||||
|
|
||||||
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![
|
||||||
|
|||||||
@@ -141,15 +141,6 @@ pub fn mode_list(
|
|||||||
},
|
},
|
||||||
ColumnType::Compression => {
|
ColumnType::Compression => {
|
||||||
Cell::new(&string_column(item.compression.to_string(), column_width))
|
Cell::new(&string_column(item.compression.to_string(), column_width))
|
||||||
}
|
|
||||||
ColumnType::DigestType => {
|
|
||||||
Cell::new(&string_column(item.digest_type.to_string(), column_width))
|
|
||||||
}
|
|
||||||
ColumnType::DigestValue => match item.digest_value {
|
|
||||||
Some(ref value) => Cell::new(&string_column(value.to_string(), column_width)),
|
|
||||||
None => Cell::new("Missing")
|
|
||||||
.with_style(Attr::ForegroundColor(color::RED))
|
|
||||||
.with_style(Attr::Bold),
|
|
||||||
},
|
},
|
||||||
ColumnType::FileSize => match item_path.metadata() {
|
ColumnType::FileSize => match item_path.metadata() {
|
||||||
Ok(metadata) => Cell::new_align(
|
Ok(metadata) => Cell::new_align(
|
||||||
|
|||||||
Reference in New Issue
Block a user