openfunctions_rs/cli/
mod.rs1use crate::core::Config;
4use anyhow::Result;
5use clap::{Parser, Subcommand};
6use std::path::PathBuf;
7
8mod build;
9mod check;
10mod test;
11
12#[derive(Parser, Debug)]
14#[command(
15 name = "openfunctions",
16 version,
17 about = "A universal framework for creating and managing LLM tools and agents."
18)]
19pub struct Cli {
20 #[arg(short, long, global = true)]
22 pub config: Option<PathBuf>,
23
24 #[command(subcommand)]
26 pub command: Option<Commands>,
27}
28
29#[derive(Subcommand, Debug)]
31pub enum Commands {
32 Build(build::BuildCommand),
34 Check(check::CheckCommand),
36 Test(test::TestCommand),
38}
39
40impl Commands {
41 pub async fn execute(&self, config: &Config) -> Result<()> {
43 match self {
44 Commands::Build(cmd) => cmd.execute(config).await,
45 Commands::Check(cmd) => cmd.execute(config).await,
46 Commands::Test(cmd) => cmd.execute(config).await,
47 }
48 }
49}