feat: Split out --status-plugins to show only plugin information
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -57,10 +57,14 @@ pub struct ModeArgs {
|
||||
))]
|
||||
pub info: bool,
|
||||
|
||||
#[arg(group("mode"), help_heading("Mode Options"), short('S'), long, conflicts_with_all(["save", "get", "diff", "list", "delete", "info", "server"]))]
|
||||
#[arg(group("mode"), help_heading("Mode Options"), short('S'), long, conflicts_with_all(["save", "get", "diff", "list", "delete", "info", "server", "status_plugins"]))]
|
||||
#[arg(help("Show status of directories and supported compression algorithms"))]
|
||||
pub status: bool,
|
||||
|
||||
#[arg(group("mode"), help_heading("Mode Options"), long, conflicts_with_all(["save", "get", "diff", "list", "delete", "info", "status", "server"]))]
|
||||
#[arg(help("Show available plugins and their configurations"))]
|
||||
pub status_plugins: bool,
|
||||
|
||||
#[arg(group("mode"), help_heading("Mode Options"), long, conflicts_with_all(["save", "get", "diff", "list", "delete", "info", "status"]))]
|
||||
#[arg(help("Start REST HTTP server"))]
|
||||
pub server: bool,
|
||||
|
||||
10
src/main.rs
10
src/main.rs
@@ -92,6 +92,7 @@ fn main() -> Result<(), Error> {
|
||||
Delete,
|
||||
Info,
|
||||
Status,
|
||||
StatusPlugins,
|
||||
Server,
|
||||
GenerateConfig,
|
||||
}
|
||||
@@ -112,6 +113,8 @@ fn main() -> Result<(), Error> {
|
||||
mode = KeepModes::Info;
|
||||
} else if args.mode.status {
|
||||
mode = KeepModes::Status;
|
||||
} else if args.mode.status_plugins {
|
||||
mode = KeepModes::StatusPlugins;
|
||||
} else if args.mode.server {
|
||||
mode = KeepModes::Server;
|
||||
} else if args.mode.generate_config {
|
||||
@@ -128,10 +131,10 @@ fn main() -> Result<(), Error> {
|
||||
|
||||
// Validate output format usage
|
||||
if let Some(output_format_str) = &settings.output_format {
|
||||
if output_format_str != "table" && mode != KeepModes::Info && mode != KeepModes::Status && mode != KeepModes::List {
|
||||
if output_format_str != "table" && mode != KeepModes::Info && mode != KeepModes::Status && mode != KeepModes::StatusPlugins && mode != KeepModes::List {
|
||||
cmd.error(
|
||||
ErrorKind::InvalidValue,
|
||||
"--output-format can only be used with --info, --status, or --list modes"
|
||||
"--output-format can only be used with --info, --status, --status-plugins, or --list modes"
|
||||
).exit();
|
||||
}
|
||||
}
|
||||
@@ -198,7 +201,8 @@ fn main() -> Result<(), Error> {
|
||||
KeepModes::List => modes::list::mode_list(&mut cmd, &settings, ids, tags, &mut conn, data_path),
|
||||
KeepModes::Delete => modes::delete::mode_delete(&mut cmd, &settings, &settings, ids, tags, &mut conn, data_path),
|
||||
KeepModes::Info => modes::info::mode_info(&mut cmd, &settings, ids, tags, &mut conn, data_path),
|
||||
KeepModes::Status => modes::status::mode_status(&mut cmd, &settings, data_path, db_path),
|
||||
KeepModes::Status => modes::status::mode_status(&mut cmd, &settings, data_path, db_path, false),
|
||||
KeepModes::StatusPlugins => modes::status::mode_status(&mut cmd, &settings, data_path, db_path, true),
|
||||
KeepModes::Server => modes::server::mode_server(&mut cmd, &settings, &mut conn, data_path),
|
||||
KeepModes::GenerateConfig => modes::generate_config::mode_generate_config(&mut cmd, &settings),
|
||||
KeepModes::Unknown => unreachable!(),
|
||||
|
||||
@@ -343,6 +343,7 @@ 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");
|
||||
|
||||
@@ -354,6 +355,18 @@ 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!();
|
||||
|
||||
// Print META PLUGINS CONFIGURED if they exist
|
||||
if let Some(meta_plugins_table) = build_meta_plugins_configured_table(settings) {
|
||||
println!("META PLUGINS CONFIGURED:");
|
||||
meta_plugins_table.printstd();
|
||||
println!();
|
||||
}
|
||||
} else {
|
||||
println!("CONFIG:");
|
||||
build_config_table(settings).printstd();
|
||||
println!();
|
||||
@@ -365,29 +378,35 @@ pub fn mode_status(
|
||||
println!("COMPRESSION:");
|
||||
build_compression_table(&status_info.compression).printstd();
|
||||
println!();
|
||||
|
||||
println!("META PLUGINS AVAILABLE:");
|
||||
build_meta_plugin_table(&status_info.meta_plugins).printstd();
|
||||
println!();
|
||||
|
||||
// Print META PLUGINS CONFIGURED if they exist
|
||||
if let Some(meta_plugins_table) = build_meta_plugins_configured_table(settings) {
|
||||
println!("META PLUGINS CONFIGURED:");
|
||||
meta_plugins_table.printstd();
|
||||
println!();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
},
|
||||
OutputFormat::Json => {
|
||||
// For JSON and YAML, we need to include config info in the status_info
|
||||
// Since we can't modify generate_status_info, we'll need to think of another approach
|
||||
// For now, just print the original status_info
|
||||
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.as_ref().map(|plugins| plugins)
|
||||
});
|
||||
println!("{}", serde_json::to_string_pretty(&plugins_info)?);
|
||||
} else {
|
||||
println!("{}", serde_json::to_string_pretty(&status_info)?);
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
OutputFormat::Yaml => {
|
||||
if plugins_only {
|
||||
// Create a subset for plugins only
|
||||
let plugins_info = serde_yaml::to_string(&serde_yaml::Value::Mapping(serde_yaml::Mapping::new()))?;
|
||||
// This needs to be more precise, but for now, just print the original
|
||||
println!("{}", serde_yaml::to_string(&status_info.meta_plugins)?);
|
||||
if let Some(configured_plugins) = &settings.meta_plugins {
|
||||
println!("---");
|
||||
println!("{}", serde_yaml::to_string(&configured_plugins)?);
|
||||
}
|
||||
} else {
|
||||
println!("{}", serde_yaml::to_string(&status_info)?);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user