refactor: integrate digest functionality into meta plugins and remove digest_engine module
Co-authored-by: aider (openai/andrew.openrouter.qwen.qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -3,7 +3,6 @@ use crate::compression_engine::CompressionType;
|
||||
use crate::db::Item;
|
||||
use crate::db::Meta;
|
||||
use crate::db::store_meta;
|
||||
use crate::digest_engine::DigestType;
|
||||
use crate::meta_plugin::MetaPluginType;
|
||||
use clap::Command;
|
||||
use clap::error::ErrorKind;
|
||||
@@ -100,7 +99,7 @@ pub fn get_format_box_chars_no_border_line_separator() -> TableFormat {
|
||||
.build()
|
||||
}
|
||||
|
||||
pub fn get_digest_type_meta(digest_type: DigestType) -> String {
|
||||
pub fn get_digest_type_meta(digest_type: MetaPluginType) -> String {
|
||||
format!("digest_{}", digest_type.to_string().to_lowercase())
|
||||
}
|
||||
|
||||
@@ -123,7 +122,7 @@ pub fn store_item_meta_value(
|
||||
pub fn store_item_digest_value(
|
||||
conn: &mut Connection,
|
||||
item: Item,
|
||||
digest_type: DigestType,
|
||||
digest_type: MetaPluginType,
|
||||
digest_value: String,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
// Save digest to meta
|
||||
@@ -137,14 +136,14 @@ pub fn store_item_digest_value(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn cmd_args_digest_type(cmd: &mut Command, args: &Args) -> DigestType {
|
||||
pub fn cmd_args_digest_type(cmd: &mut Command, args: &Args) -> MetaPluginType {
|
||||
let digest_name = args
|
||||
.item
|
||||
.digest
|
||||
.clone()
|
||||
.unwrap_or(DigestType::Sha256.to_string());
|
||||
.unwrap_or(MetaPluginType::DigestSha256.to_string());
|
||||
|
||||
let digest_type_opt = DigestType::from_str(&digest_name);
|
||||
let digest_type_opt = MetaPluginType::from_str(&digest_name);
|
||||
if digest_type_opt.is_err() {
|
||||
cmd.error(
|
||||
ErrorKind::InvalidValue,
|
||||
|
||||
Reference in New Issue
Block a user