use crate::prelude::*;
use crate::{ios_deploy::detect::DetectDevicesConfig, open::well_known::WellKnown, xcrun::simctl};
pub mod run;
pub use app_path::AppPathArgs;
mod app_path;
pub use device_name::{DeviceSimulatorBootedArgs, DeviceSimulatorUnBootedArgs};
mod device_name;
pub use bundle_identifier::BundleIdentifierArgs;
mod bundle_identifier;
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
pub struct CliArgs {
#[command(flatten)]
pub args: TopLevelCliArgs,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Args, Debug)]
#[group(required = false, multiple = false)]
pub struct TopLevelCliArgs {
#[arg(long, global = true, group = "top_level_args", alias = "json")]
machine: bool,
#[arg(long, global = true, group = "top_level_args")]
verbose: bool,
#[arg(long, short, global = true, group = "top_level_args")]
quiet: bool,
}
impl TopLevelCliArgs {
pub fn machine(&self) -> bool {
self.machine
}
pub fn human(&self) -> bool {
!self.machine()
}
pub fn verbose(&self) -> bool {
self.verbose
}
pub fn quiet(&self) -> bool {
self.quiet
}
}
#[derive(Subcommand, Debug)]
pub enum Commands {
#[clap(subcommand)]
Init(Init),
#[clap(subcommand)]
IosDeploy(IosDeploy),
#[clap(subcommand)]
Security(Security),
#[clap(subcommand)]
Spctl(Spctl),
#[clap(subcommand, name = "codesign")]
CodeSign(CodeSign),
#[clap(subcommand, name = "xcrun")]
XcRun(XcRun),
Open(#[clap(flatten)] Open),
}
#[derive(Subcommand, Debug)]
pub enum Init {
#[clap(name = "nushell")]
#[group(required = true)]
NuShell {
#[arg(long, group = "init")]
auto: bool,
#[arg(long, group = "init")]
raw_script: bool,
},
}
#[derive(Subcommand, Debug)]
pub enum IosDeploy {
Detect {
#[clap(flatten)]
config: DetectDevicesConfig,
},
Upload {
#[clap(flatten)]
app_path: app_path::AppPathArgs,
#[clap(flatten)]
auto_detect_config: DetectDevicesConfig,
},
}
#[derive(Subcommand, Debug)]
pub enum CargoBundle {
Ios,
}
#[derive(Subcommand, Debug)]
pub enum Security {
Certs,
Pems,
}
#[derive(Subcommand, Debug)]
pub enum CodeSign {
Display {
#[clap(flatten)]
app_path: AppPathArgs,
},
Sign {
#[clap(flatten)]
app_path: AppPathArgs,
},
}
#[derive(Subcommand, Debug)]
pub enum Spctl {
AssessApp {
#[clap(flatten)]
app_path: AppPathArgs,
},
}
#[derive(Subcommand, Debug)]
pub enum XcRun {
#[clap(subcommand)]
Simctl(Simctl),
}
#[derive(Debug, ValueEnum, Clone)]
pub enum Booted {
Booted,
}
#[derive(Subcommand, Debug)]
pub enum Simctl {
List,
Boot {
#[clap(flatten)]
simulator_id: DeviceSimulatorUnBootedArgs,
},
Install {
#[clap(flatten)]
booted_simulator: DeviceSimulatorBootedArgs,
#[clap(flatten)]
app_path: app_path::AppPathArgs,
},
Launch {
#[clap(flatten)]
booted_simulator: DeviceSimulatorBootedArgs,
#[clap(flatten)]
args: simctl::launch::CliLaunchArgs,
},
}
#[derive(Args, Debug)]
pub struct Open {
#[arg(long, value_enum)]
pub well_known: WellKnown,
}