refactor: Move status_plugins functionality to its own module
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -343,7 +343,6 @@ pub fn mode_status(
|
||||
settings: &config::Settings,
|
||||
data_path: PathBuf,
|
||||
db_path: PathBuf,
|
||||
plugins_only: bool,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
debug!("STATUS: Starting mode_status function");
|
||||
|
||||
@@ -355,73 +354,25 @@ pub fn mode_status(
|
||||
|
||||
match output_format {
|
||||
OutputFormat::Table => {
|
||||
if plugins_only {
|
||||
println!("META PLUGINS AVAILABLE:");
|
||||
build_meta_plugin_table(&status_info.meta_plugins).printstd();
|
||||
println!();
|
||||
println!("CONFIG:");
|
||||
build_config_table(settings).printstd();
|
||||
println!();
|
||||
|
||||
println!("PATHS:");
|
||||
build_path_table(&status_info.paths).printstd();
|
||||
println!();
|
||||
|
||||
// Always try to print META PLUGINS CONFIGURED section
|
||||
if let Some(meta_plugins_table) = build_meta_plugins_configured_table(settings) {
|
||||
println!("META PLUGINS CONFIGURED:");
|
||||
meta_plugins_table.printstd();
|
||||
println!();
|
||||
} else {
|
||||
println!("META PLUGINS CONFIGURED:");
|
||||
println!("No plugins configured");
|
||||
println!();
|
||||
}
|
||||
} else {
|
||||
println!("CONFIG:");
|
||||
build_config_table(settings).printstd();
|
||||
println!();
|
||||
|
||||
println!("PATHS:");
|
||||
build_path_table(&status_info.paths).printstd();
|
||||
println!();
|
||||
|
||||
println!("COMPRESSION:");
|
||||
build_compression_table(&status_info.compression).printstd();
|
||||
println!();
|
||||
}
|
||||
println!("COMPRESSION:");
|
||||
build_compression_table(&status_info.compression).printstd();
|
||||
println!();
|
||||
Ok(())
|
||||
},
|
||||
OutputFormat::Json => {
|
||||
if plugins_only {
|
||||
// Create a subset for plugins only
|
||||
let plugins_info = serde_json::json!({
|
||||
"meta_plugins_available": status_info.meta_plugins,
|
||||
"meta_plugins_configured": settings.meta_plugins
|
||||
});
|
||||
println!("{}", serde_json::to_string_pretty(&plugins_info)?);
|
||||
} else {
|
||||
println!("{}", serde_json::to_string_pretty(&status_info)?);
|
||||
}
|
||||
println!("{}", serde_json::to_string_pretty(&status_info)?);
|
||||
Ok(())
|
||||
},
|
||||
OutputFormat::Yaml => {
|
||||
if plugins_only {
|
||||
// Create a proper structure for plugins info
|
||||
use serde_yaml::Mapping;
|
||||
let mut plugins_mapping = Mapping::new();
|
||||
|
||||
// Add available plugins
|
||||
plugins_mapping.insert(
|
||||
serde_yaml::Value::String("meta_plugins_available".to_string()),
|
||||
serde_yaml::to_value(&status_info.meta_plugins)?,
|
||||
);
|
||||
|
||||
// Add configured plugins if they exist
|
||||
if let Some(configured_plugins) = &settings.meta_plugins {
|
||||
plugins_mapping.insert(
|
||||
serde_yaml::Value::String("meta_plugins_configured".to_string()),
|
||||
serde_yaml::to_value(configured_plugins)?,
|
||||
);
|
||||
}
|
||||
|
||||
println!("{}", serde_yaml::to_string(&plugins_mapping)?);
|
||||
} else {
|
||||
println!("{}", serde_yaml::to_string(&status_info)?);
|
||||
}
|
||||
println!("{}", serde_yaml::to_string(&status_info)?);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user