feat: add compression and digest support with database schema updates

This commit is contained in:
Andrew Phillips
2025-05-14 09:45:51 -03:00
committed by Andrew Phillips (aider)
parent 9b61a37036
commit bbdfe19836
19 changed files with 181 additions and 111 deletions

View File

@@ -1,12 +1,12 @@
use crate::db::Item;
use crate::modes::common::format_size;
use anyhow::anyhow;
use clap::error::ErrorKind;
use clap::Command;
use clap::error::ErrorKind;
use std::path::PathBuf;
use std::str::FromStr;
use crate::db::Item;
use crate::compression_engine::{get_compression_engine, CompressionType};
use crate::compression_engine::{CompressionType, get_compression_engine};
use crate::db::{get_item, get_item_last, get_item_matching};
use crate::modes::common::get_format_box_chars_no_border_line_separator;
use chrono::prelude::*;
@@ -123,8 +123,8 @@ fn show_item(
// 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 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 {
@@ -162,7 +162,7 @@ fn show_item(
Cell::new("Digest Value").with_style(Attr::Bold),
Cell::new(&dv_str),
]));
},
}
None => { /* Do nothing if None, as per original logic */ }
}