diff --git a/src/modes/status.rs b/src/modes/status.rs index dcfa2ac..1b42c05 100644 --- a/src/modes/status.rs +++ b/src/modes/status.rs @@ -113,7 +113,7 @@ fn build_compression_table() -> Table { } -fn build_meta_plugin_table() -> Table { +fn build_meta_plugin_table(enabled_meta_plugins: &Vec) -> Table { let mut meta_plugin_table = Table::new(); if std::io::stdout().is_terminal() { meta_plugin_table.set_format(*FORMAT_BOX_CHARS_NO_BORDER_LINE_SEPARATOR); @@ -124,6 +124,7 @@ fn build_meta_plugin_table() -> Table { meta_plugin_table.set_titles(row!( b->"Type", b->"Found", + b->"Enabled", b->"Binary", b->"Args", b->"Meta Name")); @@ -131,6 +132,7 @@ fn build_meta_plugin_table() -> Table { for meta_plugin_type in MetaPluginType::iter() { let mut meta_plugin = meta_plugin::get_meta_plugin(meta_plugin_type.clone()); let is_supported = meta_plugin.is_supported(); + let is_enabled = enabled_meta_plugins.contains(&meta_plugin_type); // Get program info for display purposes let meta_plugin_program: Option = META_PLUGIN_PROGRAMS[meta_plugin_type.clone()].clone(); @@ -162,6 +164,10 @@ fn build_meta_plugin_table() -> Table { true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)), false => Cell::new("No").with_style(Attr::ForegroundColor(color::RED)), }, + match is_enabled { + true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)), + false => Cell::new("No"), + }, Cell::new(&binary_display), Cell::new(&args_display), Cell::new(&meta_plugin.meta_name()), @@ -173,10 +179,27 @@ fn build_meta_plugin_table() -> Table { pub fn mode_status( _cmd: &mut Command, - _args: &crate::Args, + args: &crate::Args, data_path: PathBuf, db_path: PathBuf, ) -> Result<(), anyhow::Error> { + // Determine which meta plugins would be enabled for a save operation + let mut meta_plugin_types: Vec = crate::modes::common::cmd_args_meta_plugin_types(_cmd, &args); + + // Add digest type if specified + let digest_type = crate::modes::common::cmd_args_digest_type(_cmd, &args); + 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); + } + } + println!("PATHS:"); build_path_table(data_path, db_path).printstd(); println!(); @@ -184,6 +207,6 @@ pub fn mode_status( build_compression_table().printstd(); println!(); println!("META PLUGINS:"); - build_meta_plugin_table().printstd(); + build_meta_plugin_table(&meta_plugin_types).printstd(); Ok(()) }