liblitho 0.2.0

cli tool to flash/clone the images to storage devices
Documentation
//! Privilege elevation for raw block I/O (TUI / CLI helpers).

/// Whether elevation prerequisites are satisfied (shown in the TUI header).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ElevationCapability {
    pub ready: bool,
    pub status_label: &'static str,
}

/// Elevate the process (pkexec/sudo/UAC) so flash/clone can open block devices.
pub trait PrivilegeOps {
    /// Short name of the elevation backend (for logs).
    fn elevation_method() -> &'static str;

    /// True when the process already has privileges for block I/O.
    fn is_elevated() -> bool;

    /// Inspect whether elevation can be requested on this machine.
    fn elevation_capability() -> ElevationCapability;

    /// Check that elevation can proceed before tearing down the terminal.
    fn validate_elevation_prerequisites() -> Result<(), String>;

    /// Relaunch the current binary elevated with flash/clone selections.
    ///
    /// On Linux this may replace the process (`exec`) or spawn+wait.
    /// On Windows it spawns a UAC-elevated child.
    fn relaunch_elevated(mode: &str, device: &str, image: &str) -> Result<(), String>;

    /// Body lines for the elevation confirmation dialog.
    fn elevation_dialog_lines() -> [&'static str; 3];

    /// Portable helper for session logging (`geteuid` on Linux, `0` elsewhere).
    fn current_euid_or_0() -> u32 {
        0
    }
}