mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 06:26:15 +01:00
Use option<&str> instead of owned option string
This commit is contained in:
@@ -67,7 +67,9 @@ async fn main() {
|
||||
|
||||
println!(
|
||||
"{:?}",
|
||||
lockdown_client.get_value("ProductVersion", None).await
|
||||
lockdown_client
|
||||
.get_value(Some("ProductVersion"), None)
|
||||
.await
|
||||
);
|
||||
|
||||
println!(
|
||||
@@ -82,5 +84,5 @@ async fn main() {
|
||||
.await
|
||||
);
|
||||
println!("{:?}", lockdown_client.idevice.get_type().await.unwrap());
|
||||
println!("{:#?}", lockdown_client.get_all_values(None).await);
|
||||
println!("{:#?}", lockdown_client.get_value(None, None).await);
|
||||
}
|
||||
|
||||
@@ -69,10 +69,7 @@ async fn main() {
|
||||
.await
|
||||
.expect("Unable to connect to instproxy");
|
||||
if matches.subcommand_matches("lookup").is_some() {
|
||||
let apps = instproxy_client
|
||||
.get_apps(Some("User".to_string()), None)
|
||||
.await
|
||||
.unwrap();
|
||||
let apps = instproxy_client.get_apps(Some("User"), None).await.unwrap();
|
||||
for app in apps.keys() {
|
||||
println!("{app}");
|
||||
}
|
||||
|
||||
@@ -39,12 +39,7 @@ async fn main() {
|
||||
.subcommand(
|
||||
Command::new("get")
|
||||
.about("Gets a value")
|
||||
.arg(arg!(-v --value <STRING> "the value to get").required(true))
|
||||
.arg(arg!(-d --domain <STRING> "the domain to get in").required(false)),
|
||||
)
|
||||
.subcommand(
|
||||
Command::new("get_all")
|
||||
.about("Gets all")
|
||||
.arg(arg!(-v --value <STRING> "the value to get").required(false))
|
||||
.arg(arg!(-d --domain <STRING> "the domain to get in").required(false)),
|
||||
)
|
||||
.subcommand(
|
||||
@@ -86,8 +81,8 @@ async fn main() {
|
||||
|
||||
match matches.subcommand() {
|
||||
Some(("get", sub_m)) => {
|
||||
let key = sub_m.get_one::<String>("value").unwrap();
|
||||
let domain = sub_m.get_one::<String>("domain").cloned();
|
||||
let key = sub_m.get_one::<String>("value").map(|x| x.as_str());
|
||||
let domain = sub_m.get_one::<String>("domain").map(|x| x.as_str());
|
||||
|
||||
match lockdown_client.get_value(key, domain).await {
|
||||
Ok(value) => {
|
||||
@@ -98,27 +93,18 @@ async fn main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(("get_all", sub_m)) => {
|
||||
let domain = sub_m.get_one::<String>("domain").cloned();
|
||||
|
||||
match lockdown_client.get_all_values(domain).await {
|
||||
Ok(value) => {
|
||||
println!("{}", pretty_print_plist(&plist::Value::Dictionary(value)));
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Error getting value: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some(("set", sub_m)) => {
|
||||
let key = sub_m.get_one::<String>("key").unwrap();
|
||||
let value_str = sub_m.get_one::<String>("value").unwrap();
|
||||
let domain = sub_m.get_one::<String>("domain").cloned();
|
||||
let domain = sub_m.get_one::<String>("domain");
|
||||
|
||||
let value = Value::String(value_str.clone());
|
||||
|
||||
match lockdown_client.set_value(key, value, domain).await {
|
||||
match lockdown_client
|
||||
.set_value(key, value, domain.map(|x| x.as_str()))
|
||||
.await
|
||||
{
|
||||
Ok(()) => println!("Successfully set"),
|
||||
Err(e) => eprintln!("Error setting value: {e}"),
|
||||
}
|
||||
|
||||
@@ -89,7 +89,10 @@ async fn main() {
|
||||
.await
|
||||
.expect("Unable to connect to lockdown");
|
||||
|
||||
let product_version = match lockdown_client.get_value("ProductVersion", None).await {
|
||||
let product_version = match lockdown_client
|
||||
.get_value(Some("ProductVersion"), None)
|
||||
.await
|
||||
{
|
||||
Ok(p) => p,
|
||||
Err(_) => {
|
||||
lockdown_client
|
||||
@@ -97,7 +100,7 @@ async fn main() {
|
||||
.await
|
||||
.unwrap();
|
||||
lockdown_client
|
||||
.get_value("ProductVersion", None)
|
||||
.get_value(Some("ProductVersion"), None)
|
||||
.await
|
||||
.unwrap()
|
||||
}
|
||||
@@ -182,21 +185,22 @@ async fn main() {
|
||||
.await
|
||||
.expect("Unable to read signature");
|
||||
|
||||
let unique_chip_id = match lockdown_client.get_value("UniqueChipID", None).await {
|
||||
Ok(u) => u,
|
||||
Err(_) => {
|
||||
lockdown_client
|
||||
.start_session(&provider.get_pairing_file().await.unwrap())
|
||||
.await
|
||||
.expect("Unable to start session");
|
||||
lockdown_client
|
||||
.get_value("UniqueChipID", None)
|
||||
.await
|
||||
.expect("Unable to get UniqueChipID")
|
||||
let unique_chip_id =
|
||||
match lockdown_client.get_value(Some("UniqueChipID"), None).await {
|
||||
Ok(u) => u,
|
||||
Err(_) => {
|
||||
lockdown_client
|
||||
.start_session(&provider.get_pairing_file().await.unwrap())
|
||||
.await
|
||||
.expect("Unable to start session");
|
||||
lockdown_client
|
||||
.get_value(Some("UniqueChipID"), None)
|
||||
.await
|
||||
.expect("Unable to get UniqueChipID")
|
||||
}
|
||||
}
|
||||
}
|
||||
.as_unsigned_integer()
|
||||
.expect("Unexpected value for chip IP");
|
||||
.as_unsigned_integer()
|
||||
.expect("Unexpected value for chip IP");
|
||||
|
||||
mounter_client
|
||||
.mount_personalized_with_callback(
|
||||
|
||||
Reference in New Issue
Block a user