use clap::Subcommand;
pub mod version;
pub mod build;
pub mod testflight;
#[derive(Subcommand, Debug)]
pub enum IosCommands {
Version {},
Bump {
#[arg(default_value = "build")]
part: String,
},
Archive {
#[arg(short, long, default_value = "Release")]
configuration: String,
},
Export {
#[arg(short, long, default_value = "app-store")]
method: String,
},
Upload {},
Release {
#[arg(short, long)]
version: Option<String>,
},
Status {
#[arg(short, long)]
app_id: Option<String>,
},
TestflightAdd {
email: String,
first_name: String,
last_name: String,
},
TestflightRemove {
tester_id: String,
},
}
pub async fn route_ios_command(command: IosCommands) -> anyhow::Result<()> {
match command {
IosCommands::Version {} => {
version::show_version().await?;
}
IosCommands::Bump { part } => {
version::bump(&part).await?;
}
IosCommands::Archive { configuration } => {
build::archive_app(&configuration).await?;
}
IosCommands::Export { method } => {
build::export_app(&method).await?;
}
IosCommands::Upload {} => {
build::upload_app().await?;
}
IosCommands::Release { version } => {
build::release(version.as_deref()).await?;
}
IosCommands::Status { app_id } => {
build::check_status(app_id.as_deref()).await?;
}
IosCommands::TestflightAdd {
email,
first_name,
last_name,
} => {
testflight::add_tester(&email, &first_name, &last_name).await?;
}
IosCommands::TestflightRemove { tester_id } => {
testflight::remove_tester(&tester_id).await?;
}
}
Ok(())
}