From b10815bb0b96c9a309117b889653976f0e438bb4 Mon Sep 17 00:00:00 2001 From: Jackson Coxson Date: Wed, 26 Feb 2025 09:58:26 -0700 Subject: [PATCH] Fix indentation for plist print --- idevice/src/util.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/idevice/src/util.rs b/idevice/src/util.rs index d17988f..7a49d61 100644 --- a/idevice/src/util.rs +++ b/idevice/src/util.rs @@ -28,7 +28,13 @@ fn print_plist(p: &Value, indentation: usize) -> String { Value::Array(vec) => { let items: Vec = vec .iter() - .map(|v| print_plist(v, indentation + 2)) + .map(|v| { + format!( + "{}{}", + " ".repeat(indentation + 2), + print_plist(v, indentation + 2) + ) + }) .collect(); format!("[\n{}\n{}]", items.join(",\n"), indent) } @@ -44,7 +50,7 @@ fn print_plist(p: &Value, indentation: usize) -> String { ) }) .collect(); - format!("{}{{\n{}\n{}}}", indent, items.join(",\n"), indent) + format!("{{\n{}\n{}}}", items.join(",\n"), indent) } Value::Boolean(b) => format!("{}", b), Value::Data(vec) => { @@ -55,7 +61,11 @@ fn print_plist(p: &Value, indentation: usize) -> String { .map(|b| format!("{:02X}", b)) .collect::>() .join(" "); - format!("Data({}... Len: {})", preview, len) + if len > 20 { + format!("Data({}... Len: {})", preview, len) + } else { + format!("Data({} Len: {})", preview, len) + } } Value::Date(date) => format!("Date({})", date.to_xml_format()), Value::Real(f) => format!("{}", f),