mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
fix: fixes misagent cmd + adds new install subcmd (#59)
Calling init twice is a bad idea and causes the program to crash, also adds an install command for provisioning profile paths
This commit is contained in:
@@ -28,12 +28,20 @@ pub fn register() -> JkCommand {
|
|||||||
.required(true),
|
.required(true),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.with_subcommand(
|
||||||
|
"install",
|
||||||
|
JkCommand::new()
|
||||||
|
.help("Install a provisioning profile on the device")
|
||||||
|
.with_argument(
|
||||||
|
JkArgument::new()
|
||||||
|
.with_help("Path to the provisioning profile to install")
|
||||||
|
.required(true),
|
||||||
|
),
|
||||||
|
)
|
||||||
.subcommand_required(true)
|
.subcommand_required(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn main(arguments: &CollectedArguments, provider: Box<dyn IdeviceProvider>) {
|
pub async fn main(arguments: &CollectedArguments, provider: Box<dyn IdeviceProvider>) {
|
||||||
tracing_subscriber::fmt::init();
|
|
||||||
|
|
||||||
let mut misagent_client = MisagentClient::connect(&*provider)
|
let mut misagent_client = MisagentClient::connect(&*provider)
|
||||||
.await
|
.await
|
||||||
.expect("Unable to connect to misagent");
|
.expect("Unable to connect to misagent");
|
||||||
@@ -67,6 +75,16 @@ pub async fn main(arguments: &CollectedArguments, provider: Box<dyn IdeviceProvi
|
|||||||
.await
|
.await
|
||||||
.expect("Failed to remove");
|
.expect("Failed to remove");
|
||||||
}
|
}
|
||||||
|
"install" => {
|
||||||
|
let path = sub_args
|
||||||
|
.next_argument::<PathBuf>()
|
||||||
|
.expect("No profile path passed");
|
||||||
|
let profile = tokio::fs::read(path).await.expect("Unable to read profile");
|
||||||
|
misagent_client
|
||||||
|
.install(profile)
|
||||||
|
.await
|
||||||
|
.expect("Failed to install profile");
|
||||||
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user