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,
BranchTaskExpression {
#[command(subcommand)]
command: GetCommand,
},
InlineFunction {
#[command(subcommand)]
command: GetCommand,
},
LeafTaskExpression {
#[command(subcommand)]
command: GetCommand,
},
PartialPlaceholderBranchTaskExpression {
#[command(subcommand)]
command: GetCommand,
},
PartialPlaceholderScalarFunctionTaskExpression {
#[command(subcommand)]
command: GetCommand,
},
PlaceholderScalarFunctionTaskExpression {
#[command(subcommand)]
command: GetCommand,
},
RemoteFunction {
#[command(subcommand)]
command: GetCommand,
},
ScalarFunctionTaskExpression {
#[command(subcommand)]
command: GetCommand,
},
VectorCompletionTaskExpression {
#[command(subcommand)]
command: GetCommand,
},
}
impl Commands {
pub async fn handle(self, handle: &objectiveai_cli_sdk::output::Handle) -> Result<(), crate::error::Error> {
match self {
Commands::List => {
const NAMES: &[&str] = &["BranchTaskExpression", "InlineFunction", "LeafTaskExpression", "PartialPlaceholderBranchTaskExpression", "PartialPlaceholderScalarFunctionTaskExpression", "PlaceholderScalarFunctionTaskExpression", "RemoteFunction", "ScalarFunctionTaskExpression", "VectorCompletionTaskExpression"];
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schemas>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schemas {
schemas: NAMES.iter().map(|s| s.to_string()).collect(),
},
},
).emit(handle).await;
Ok(())
}
Commands::BranchTaskExpression { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/functions.alpha_scalar.BranchTaskExpression.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::InlineFunction { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/functions.alpha_scalar.InlineFunction.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::LeafTaskExpression { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/functions.alpha_scalar.LeafTaskExpression.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::PartialPlaceholderBranchTaskExpression { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/functions.alpha_scalar.PartialPlaceholderBranchTaskExpression.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::PartialPlaceholderScalarFunctionTaskExpression { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/functions.alpha_scalar.PartialPlaceholderScalarFunctionTaskExpression.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::PlaceholderScalarFunctionTaskExpression { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/functions.alpha_scalar.PlaceholderScalarFunctionTaskExpression.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::RemoteFunction { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/functions.alpha_scalar.RemoteFunction.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::ScalarFunctionTaskExpression { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/functions.alpha_scalar.ScalarFunctionTaskExpression.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::VectorCompletionTaskExpression { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../objectiveai-json-schema/functions.alpha_scalar.VectorCompletionTaskExpression.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
}
}
}