use crate::core::Config;
use anyhow::Result;
use clap::{Parser, Subcommand};
use std::path::PathBuf;
mod build;
mod check;
mod test;
#[derive(Parser, Debug)]
#[command(
name = "openfunctions",
version,
about = "A universal framework for creating and managing LLM tools and agents."
)]
pub struct Cli {
#[arg(short, long, global = true)]
pub config: Option<PathBuf>,
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Build(build::BuildCommand),
Check(check::CheckCommand),
Test(test::TestCommand),
}
impl Commands {
pub async fn execute(&self, config: &Config) -> Result<()> {
match self {
Commands::Build(cmd) => cmd.execute(config).await,
Commands::Check(cmd) => cmd.execute(config).await,
Commands::Test(cmd) => cmd.execute(config).await,
}
}
}