1use crate::prelude::*;
2
3use crate::{ios_deploy::detect::DetectDevicesConfig, open::well_known::WellKnown, xcrun::simctl};
4
5pub mod run;
6
7pub use app_path::AppPathArgs;
8mod app_path;
9pub use device_name::{DeviceSimulatorBootedArgs, DeviceSimulatorUnBootedArgs};
10mod device_name;
11pub use bundle_identifier::BundleIdentifierArgs;
12mod bundle_identifier;
13
14#[derive(Parser, Debug)]
15#[command(version, about, long_about = None)]
16#[command(propagate_version = true)]
17pub struct CliArgs {
18 #[command(flatten)]
19 pub args: TopLevelCliArgs,
20
21 #[command(subcommand)]
22 pub command: Commands,
23}
24
25#[derive(Args, Debug)]
26#[group(required = false, multiple = false)]
27pub struct TopLevelCliArgs {
28 #[arg(long, global = true, group = "top_level_args", alias = "json")]
31 machine: bool,
32
33 #[arg(long, global = true, group = "top_level_args")]
35 verbose: bool,
36
37 #[arg(long, short, global = true, group = "top_level_args")]
39 quiet: bool,
40}
41
42impl TopLevelCliArgs {
43 pub fn machine(&self) -> bool {
44 self.machine
45 }
46
47 pub fn human(&self) -> bool {
48 !self.machine()
49 }
50
51 pub fn verbose(&self) -> bool {
52 self.verbose
53 }
54
55 pub fn quiet(&self) -> bool {
56 self.quiet
57 }
58}
59
60#[derive(Subcommand, Debug)]
61pub enum Commands {
62 #[clap(subcommand)]
64 Init(Init),
65
66 #[clap(subcommand)]
67 IosDeploy(IosDeploy),
68
69 #[clap(subcommand)]
72 Security(Security),
73
74 #[clap(subcommand)]
75 Spctl(Spctl),
76
77 #[clap(subcommand, name = "codesign")]
78 CodeSign(CodeSign),
79
80 #[clap(subcommand, name = "xcrun")]
81 XcRun(XcRun),
82
83 Open(#[clap(flatten)] Open),
84}
85
86#[derive(Subcommand, Debug)]
87pub enum Init {
88 #[clap(name = "nushell")]
89 #[group(required = true)]
90 NuShell {
91 #[arg(long, group = "init")]
95 auto: bool,
96
97 #[arg(long, group = "init")]
101 raw_script: bool,
102 },
103}
104
105#[derive(Subcommand, Debug)]
106pub enum IosDeploy {
107 Detect {
109 #[clap(flatten)]
110 config: DetectDevicesConfig,
111 },
112 Upload {
114 #[clap(flatten)]
115 app_path: app_path::AppPathArgs,
116
117 #[clap(flatten)]
118 auto_detect_config: DetectDevicesConfig,
119 },
120}
121
122#[derive(Subcommand, Debug)]
123pub enum CargoBundle {
124 Ios,
126}
127
128#[derive(Subcommand, Debug)]
129pub enum Security {
130 Certs,
131 Pems,
132}
133
134#[derive(Subcommand, Debug)]
135pub enum CodeSign {
136 Display {
138 #[clap(flatten)]
139 app_path: AppPathArgs,
140 },
141 Sign {
142 #[clap(flatten)]
143 app_path: AppPathArgs,
144 },
145}
146
147#[derive(Subcommand, Debug)]
148pub enum Spctl {
149 AssessApp {
150 #[clap(flatten)]
151 app_path: AppPathArgs,
152 },
153}
154
155#[derive(Subcommand, Debug)]
156pub enum XcRun {
157 #[clap(subcommand)]
158 Simctl(Simctl),
159}
160
161#[derive(Debug, ValueEnum, Clone)]
162pub enum Booted {
163 Booted,
164}
165
166#[derive(Subcommand, Debug)]
167pub enum Simctl {
168 List,
169 Boot {
170 #[clap(flatten)]
171 simulator_id: DeviceSimulatorUnBootedArgs,
172 },
173 Install {
174 #[clap(flatten)]
175 booted_simulator: DeviceSimulatorBootedArgs,
176
177 #[clap(flatten)]
178 app_path: app_path::AppPathArgs,
179 },
180 Launch {
181 #[clap(flatten)]
182 booted_simulator: DeviceSimulatorBootedArgs,
183
184 #[clap(flatten)]
185 args: simctl::launch::CliLaunchArgs,
186 },
187}
188
189#[derive(Args, Debug)]
190pub struct Open {
191 #[arg(long, value_enum)]
192 pub well_known: WellKnown,
193}