feat: make digest_value optional and add digest display

This commit is contained in:
Andrew Phillips
2025-05-13 17:49:19 -03:00
committed by Andrew Phillips (aider)
parent 1d9ca1b9dd
commit 1aaf1e6221
4 changed files with 18 additions and 8 deletions

View File

@@ -142,6 +142,17 @@ pub fn mode_list(
ColumnType::Compression => {
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() {
Ok(metadata) => Cell::new_align(
&size_column(
@@ -152,8 +163,8 @@ pub fn mode_list(
Alignment::RIGHT,
),
Err(_) => Cell::new_align("Missing", Alignment::RIGHT)
.with_style(Attr::ForegroundColor(color::RED))
.with_style(Attr::Bold),
.with_style(Attr::ForegroundColor(color::RED))
.with_style(Attr::Bold),
},
ColumnType::FilePath => Cell::new(&string_column(
item_path.clone().into_os_string().into_string().unwrap(),