fn main() {
#[cfg(target_os = "macos")]
{
use autoitx::ext::macos::{Permission, check, request};
let ask = std::env::args().any(|a| a == "--ask");
println!(
"binary: {}",
std::env::current_exe().unwrap_or_default().display()
);
println!(
"\nGrants follow the binary's path and signature, so this exact file\n\
is what was allowed or denied — not \"the project\".\n"
);
for permission in [Permission::Accessibility, Permission::ScreenRecording] {
let status = if ask {
request(permission)
} else {
check(permission)
};
println!("{permission:<20?} {status:?}");
if !status.is_granted() {
println!(" {}\n", Permission::hint(permission).replace('\n', "\n "));
}
}
if !ask {
println!("\nRe-run with --ask to show the system prompt.");
}
}
#[cfg(not(target_os = "macos"))]
println!("This example reports macOS privacy permissions; there are none to report here.");
}