use clap::Subcommand;
#[derive(Subcommand)]
#[command(rename_all = "verbatim")]
pub enum GetCommand {
#[command(name = "get")]
Get,
}
#[derive(Subcommand)]
#[command(rename_all = "verbatim")]
pub enum Commands {
#[command(name = "list")]
List,
FunctionProfilePair {
#[command(subcommand)]
command: GetCommand,
},
Pair {
#[command(subcommand)]
command: GetCommand,
},
Profile {
#[command(subcommand)]
command: GetCommand,
},
}
impl Commands {
pub async fn handle(self, handle: &objectiveai_sdk::cli::output::Handle) -> Result<(), crate::error::Error> {
match self {
Commands::List => {
const NAMES: &[&str] = &["FunctionProfilePair", "Pair", "Profile"];
objectiveai_sdk::cli::output::Output::<objectiveai_sdk::cli::output::Schemas>::Notification(
objectiveai_sdk::cli::output::Notification {
value: objectiveai_sdk::cli::output::Schemas {
schemas: NAMES.iter().map(|s| s.to_string()).collect(),
},
},
).emit(handle).await;
Ok(())
}
Commands::FunctionProfilePair { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../../../../objectiveai-json-schema/cli.output.notification.functions.profiles.FunctionProfilePair.json"),
).expect("embedded JSON Schema must parse");
objectiveai_sdk::cli::output::Output::<objectiveai_sdk::cli::output::Schema>::Notification(
objectiveai_sdk::cli::output::Notification {
value: objectiveai_sdk::cli::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::Pair { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../../../../objectiveai-json-schema/cli.output.notification.functions.profiles.Pair.json"),
).expect("embedded JSON Schema must parse");
objectiveai_sdk::cli::output::Output::<objectiveai_sdk::cli::output::Schema>::Notification(
objectiveai_sdk::cli::output::Notification {
value: objectiveai_sdk::cli::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::Profile { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../../../../objectiveai-json-schema/cli.output.notification.functions.profiles.Profile.json"),
).expect("embedded JSON Schema must parse");
objectiveai_sdk::cli::output::Output::<objectiveai_sdk::cli::output::Schema>::Notification(
objectiveai_sdk::cli::output::Notification {
value: objectiveai_sdk::cli::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
}
}
}