refactor: unify digest plugin type handling
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -169,22 +169,9 @@ pub fn settings_meta_plugin_types(cmd: &mut Command, settings: &config::Settings
|
||||
meta_plugin_types
|
||||
}
|
||||
|
||||
pub fn settings_digest_type(cmd: &mut Command, settings: &config::Settings) -> MetaPluginType {
|
||||
let digest_name = settings
|
||||
.digest
|
||||
.clone()
|
||||
.unwrap_or(MetaPluginType::DigestSha256.to_string());
|
||||
|
||||
let digest_type_opt = MetaPluginType::from_str(&digest_name);
|
||||
if digest_type_opt.is_err() {
|
||||
cmd.error(
|
||||
ErrorKind::InvalidValue,
|
||||
format!("Invalid digest algorithm '{}'. Use 'sha256' or 'md5'", digest_name),
|
||||
)
|
||||
.exit();
|
||||
}
|
||||
|
||||
digest_type_opt.unwrap()
|
||||
pub fn settings_digest_type(_cmd: &mut Command, _settings: &config::Settings) -> MetaPluginType {
|
||||
// The digest plugin is now unified, always return Digest
|
||||
MetaPluginType::Digest
|
||||
}
|
||||
|
||||
pub fn settings_compression_type(cmd: &mut Command, settings: &config::Settings) -> CompressionType {
|
||||
|
||||
@@ -141,18 +141,9 @@ pub fn mode_status(
|
||||
let mut meta_plugin_types: Vec<MetaPluginType> = crate::modes::common::settings_meta_plugin_types(_cmd, settings);
|
||||
log::debug!("STATUS: Got {} meta plugin types", meta_plugin_types.len());
|
||||
|
||||
// Add digest type if specified
|
||||
let digest_type = crate::modes::common::settings_digest_type(_cmd, settings);
|
||||
let digest_meta_plugin_type = match digest_type {
|
||||
crate::meta_plugin::MetaPluginType::DigestSha256 => Some(MetaPluginType::DigestSha256),
|
||||
crate::meta_plugin::MetaPluginType::DigestMd5 => Some(MetaPluginType::DigestMd5),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
if let Some(digest_plugin_type) = digest_meta_plugin_type {
|
||||
if !meta_plugin_types.contains(&digest_plugin_type) {
|
||||
meta_plugin_types.push(digest_plugin_type);
|
||||
}
|
||||
// Always add the Digest plugin if not present
|
||||
if !meta_plugin_types.contains(&MetaPluginType::Digest) {
|
||||
meta_plugin_types.push(MetaPluginType::Digest);
|
||||
}
|
||||
|
||||
// Determine which compression type would be enabled for a save operation
|
||||
|
||||
Reference in New Issue
Block a user