afc get device info

This commit is contained in:
Jackson Coxson
2025-04-05 12:07:55 -06:00
parent 65df561ea1
commit 12f2a22b1e
5 changed files with 150 additions and 14 deletions

View File

@@ -1,9 +1,7 @@
// Jackson Coxson
use std::path::PathBuf;
use clap::{arg, value_parser, Arg, Command};
use idevice::{afc::AfcClient, misagent::MisagentClient, IdeviceService};
use clap::{Arg, Command};
use idevice::{afc::AfcClient, IdeviceService};
mod common;
@@ -51,11 +49,17 @@ async fn main() {
.about("Remove a provisioning profile")
.arg(Arg::new("path").required(true).index(1)),
)
.subcommand(
Command::new("remove_all")
.about("Remove a provisioning profile")
.arg(Arg::new("path").required(true).index(1)),
)
.subcommand(
Command::new("info")
.about("Get info about a file")
.arg(Arg::new("path").required(true).index(1)),
)
.subcommand(Command::new("device_info").about("Get info about the device"))
.get_matches();
if matches.get_flag("about") {
@@ -87,7 +91,11 @@ async fn main() {
let path = matches.get_one::<String>("path").expect("No path passed");
afc_client.mk_dir(path).await.expect("Failed to mkdir");
} else if let Some(matches) = matches.subcommand_matches("remove") {
let path = matches.get_one::<String>("id").expect("No path passed");
let path = matches.get_one::<String>("path").expect("No path passed");
afc_client.remove(path).await.expect("Failed to remove");
} else if let Some(matches) = matches.subcommand_matches("remove_all") {
let path = matches.get_one::<String>("path").expect("No path passed");
afc_client.remove_all(path).await.expect("Failed to remove");
} else if let Some(matches) = matches.subcommand_matches("info") {
let path = matches.get_one::<String>("path").expect("No path passed");
let res = afc_client
@@ -95,6 +103,12 @@ async fn main() {
.await
.expect("Failed to get file info");
println!("{res:#?}");
} else if matches.subcommand_matches("device_info").is_some() {
let res = afc_client
.get_device_info()
.await
.expect("Failed to get file info");
println!("{res:#?}");
} else {
eprintln!("Invalid usage, pass -h for help");
}