liblitho 0.2.0

cli tool to flash/clone the images to storage devices
Documentation
//! Privilege elevation — re-exports [`liblitho::platform`] privilege façade.
//!
//! Implementations live under `platform/{linux,windows,macos}/privilege.rs`.

pub use liblitho::platform::{
    current_euid_or_0, elevation_capability, elevation_dialog_lines, elevation_method, is_elevated,
    relaunch_elevated, validate_elevation_prerequisites, ElevationCapability,
};

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn elevated_process_reports_capability_ready() {
        if is_elevated() {
            assert!(elevation_capability().ready);
        }
    }

    #[cfg(target_os = "linux")]
    #[test]
    fn polkit_ready_implies_pkexec_method() {
        let cap = elevation_capability();
        if cap.ready && cap.status_label == "polkit ready" {
            assert_eq!(elevation_method(), "pkexec");
        }
    }

    #[cfg(target_os = "linux")]
    #[test]
    fn sudo_ready_implies_sudo_method() {
        let cap = elevation_capability();
        if cap.ready && cap.status_label == "sudo ready" {
            assert_eq!(elevation_method(), "sudo");
        }
    }
}