hysterical 0.1.0

A useful Rust library used for fetching system information that is lightweight
Documentation
use std::process::Command;

/// This function is the entrance to the library.
///
/// On this function being run, it will run threads for fetching
/// System information, such as HysOSInfo, HysCPUInfo.
/// A full list of outputs are in the GitHub README or is in the
/// HysSysInfo struct. A HysSysInfo struct will be created, which
/// will be used to store the results of the subfunctions.
///
/// So far, this function only supports the big 3 OS'
/// (Windows, Linux, macOS) however it is planned to support
/// mobile devices and other operating systems.
///
/// Params: None
///
/// Returns: ```HysSysInfo```
fn fetch() -> HysSysInfo {
    // First, check which operating system this is
    let mut target_os = HysOSType::UNKNOWN;
    if cfg!(target_os = "windows") {
        target_os = HysOSType::WINDOWS;
    }
    if cfg!(target_os = "linux") {
        target_os = HysOSType::LINUX;
    }
    if cfg!(target_os = "macos") {
        target_os = HysOSType::MACOS;
    }

    // Next, query and store the data inside each os the information structs

    let os = HysOSInfo::fetch();

    todo!()
}

impl HysOSInfo {
    pub fn fetch() -> HysOSInfo {
        //#[cfg(target_os = "linux")]
        // let computer_name: String = match Command::new("cat").arg("/etc/hostname").output() {
        //     Ok(value) => value.stdout
        //     Err(err) => {
        //         println!("Failed to get OS Info [computer_name]");
        //         "".to_string()
        //     }
        // }
        todo!()
    }
}


enum HysOSType {
    WINDOWS,
    MACOS,
    LINUX,
    UNKNOWN,
}

struct HysSysInfo {
    os: HysOSInfo,
    cpu: HysCPUInfo,
    gpu: HysGPUInfo,
    ram: HysMemInfo,
    disk: HysDiskInfo,
    network: HysNetworkInfo,
}

pub struct HysOSInfo {
    name: String,
    short_name: String,
    version: String,
    os_architecture: String,
    status: String,
    computer_name: String,
    // TODO: Change to datetime once you learn how to get it
    uptime: String,
}

pub struct HysCPUInfo {
    pub vendor: String,
    pub model: String,
    pub name: String,
    pub frequency: String,
    pub architecture: HysCPUArchitecture,
    pub cores: String,
    pub logical_cores: String,
    pub cache_size: CPUCacheSize,
    pub virtualization: bool,
}

pub enum HysCPUArchitecture {
    X86,
    Arm,
    X64,
    Neutral,
    Arm64,
    X86OnArm64,
    Unknown,
}

pub struct CPUCacheSize {
    pub L1: String,
    pub L2: String,
    pub L3: String,
}

pub struct HysGPUInfo {
    index: u8,
    vendor: String,
    model: String,
    memory: u128,
    device_id: String,
    refresh_rate: HysGPURefreshRate,
    display_drivers_location: Vec<String>,
    driver_version: String,
    video_mode_description: Vec<String>,
    status: bool,
}

pub struct HysGPURefreshRate {
    min: u32,
    max: u32,
}

pub struct HysMemInfo {
    index: u8,
    vendor: String,
    model: String,
    serial_number: String,
    total_memory: u64,
    free_memory: u64,
}

pub struct HysDiskInfo {
    index: u8,
    vendor: String,
    model: String,
    serial_number: String,

    /// This value is in bytes. For reference, 1
    capacity: u128,
    free: u128,
    free_percent: f64,
    disk_type: HysDiskType,
    #[cfg(target_os = "windows")]
    disk_mount_char: char,
}

pub enum HysDiskType {
    FLOPPY,
    CD,
    HD,
    SSD,
    M2,

    UNKNOWN,
}

pub struct HysNetworkInfo {

}