use crate::commands;
use clap::{Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(about = "CLI for building with Turnkey Verifiable Cloud", long_about = None)]
pub struct Cli {
#[command(subcommand)]
command: Commands,
}
impl Cli {
pub async fn run() -> anyhow::Result<()> {
let args = Cli::parse();
match args.command {
Commands::Deploy { command } => match command {
DeployCommands::Approve(args) => commands::deploy::approve::run(args).await,
DeployCommands::GetStatus(args) => commands::deploy::get_status::run(args).await,
DeployCommands::Status(args) => commands::deploy::status::run(args).await,
DeployCommands::Create(args) => commands::deploy::create::run(args).await,
DeployCommands::Init(args) => commands::deploy::init::run(args).await,
},
Commands::App { command } => match command {
AppCommands::Status(args) => commands::app::status::run(args).await,
AppCommands::List(args) => commands::app::list::run(args).await,
AppCommands::Create(args) => commands::app::create::run(args).await,
AppCommands::Init(args) => commands::app::init::run(args).await,
},
Commands::Login(args) => commands::login::run(args).await,
}
}
}
#[derive(Debug, Subcommand)]
enum Commands {
Login(commands::login::Args),
Deploy {
#[command(subcommand)]
command: DeployCommands,
},
App {
#[command(subcommand)]
command: AppCommands,
},
}
#[derive(Debug, Subcommand)]
enum DeployCommands {
Approve(commands::deploy::approve::Args),
GetStatus(commands::deploy::get_status::Args),
Status(commands::deploy::status::Args),
Create(commands::deploy::create::Args),
Init(commands::deploy::init::Args),
}
#[derive(Debug, Subcommand)]
enum AppCommands {
Status(commands::app::status::Args),
List(commands::app::list::Args),
Create(commands::app::create::Args),
Init(commands::app::init::Args),
}