use clap::{Parser, Subcommand};
use super::help;
use crate::runtime::{EXIT_SUCCESS, ExitCode};
#[derive(Parser, Default)]
#[command(
name = "provider",
about = "Manage AI providers and credentials",
color = clap::ColorChoice::Auto
)]
pub struct ProviderArgs {
#[command(subcommand)]
pub command: Option<ProviderCommands>,
}
#[derive(Subcommand)]
pub enum ProviderCommands {
List {
#[arg(long)]
json: bool,
},
Connect {
provider: Option<String>,
},
Disconnect {
provider: Option<String>,
},
Add {
url: String,
},
Remove {
provider_id: String,
},
Catalog,
Update {
provider_id: Option<String>,
},
}
pub fn handle(args: &ProviderArgs) -> ExitCode {
let Some(cmd) = &args.command else {
return help::print_subcommand_help::<ProviderArgs>();
};
match cmd {
ProviderCommands::List { json } => {
help::unimplemented(&format!("Provider list — not yet implemented (json: {json})"));
EXIT_SUCCESS
}
ProviderCommands::Connect { provider } => {
help::unimplemented(&format!(
"Provider connect — not yet implemented (provider: {})",
provider.as_deref().unwrap_or("<interactive>")
));
EXIT_SUCCESS
}
ProviderCommands::Disconnect { provider } => {
help::unimplemented(&format!(
"Provider disconnect — not yet implemented (provider: {})",
provider.as_deref().unwrap_or("<all>")
));
EXIT_SUCCESS
}
ProviderCommands::Add { url } => {
help::unimplemented(&format!("Provider add — not yet implemented (url: {url})"));
EXIT_SUCCESS
}
ProviderCommands::Remove { provider_id } => {
help::unimplemented(&format!(
"Provider remove — not yet implemented (provider_id: {provider_id})"
));
EXIT_SUCCESS
}
ProviderCommands::Catalog => {
help::unimplemented("Provider catalog — not yet implemented");
EXIT_SUCCESS
}
ProviderCommands::Update { provider_id } => {
help::unimplemented(&format!(
"Provider update — not yet implemented (provider_id: {})",
provider_id.as_deref().unwrap_or("<all>")
));
EXIT_SUCCESS
}
}
}