pub(crate) mod init;
pub(crate) mod serve;
use std::path::PathBuf;
use clap::{Parser, Subcommand};
use crate::error::AppError;
#[derive(Debug, Parser)]
#[command(
name = "o402",
version = env!("CARGO_PKG_VERSION"),
about = "OpenAI-compatible gateway, paid with x402."
)]
struct Cli {
#[command(subcommand)]
command: Command,
}
#[derive(Debug, Subcommand)]
enum Command {
Init {
#[arg(long, default_value = "gateway.toml")]
path: PathBuf,
},
Serve {
#[arg(long)]
config: PathBuf,
},
}
pub(crate) async fn run() -> Result<(), AppError> {
match Cli::parse().command {
Command::Init { path } => init::run(&path),
Command::Serve { config } => serve::run(&config).await,
}
}