pub mod adapter;
pub mod generate;
pub mod inspect;
pub mod schema;
pub mod serve;
use clap::Subcommand;
use crate::cli::output::OutputFormat;
use crate::error::ProxyResult;
#[derive(Debug, Subcommand)]
pub enum Command {
#[command(visible_alias = "i")]
Inspect(inspect::InspectCommand),
#[command(visible_alias = "s")]
Serve(serve::ServeCommand),
#[command(visible_alias = "g")]
Generate(generate::GenerateCommand),
#[command(visible_alias = "sch")]
Schema(schema::SchemaCommand),
#[command(visible_alias = "adp")]
Adapter(adapter::AdapterCommand),
}
impl Command {
pub async fn execute(self, format: OutputFormat) -> ProxyResult<()> {
match self {
Command::Inspect(cmd) => cmd.execute(format).await,
Command::Serve(cmd) => {
cmd.execute().await
}
Command::Generate(cmd) => {
cmd.execute().await
}
Command::Schema(cmd) => {
cmd.execute(format).await
}
Command::Adapter(cmd) => {
cmd.execute(format).await
}
}
}
}