btoprs 0.2.2

A dependency-free terminal resource monitor
use std::process::Command;

fn main() {
    let rustc = std::env::var("RUSTC").unwrap_or_else(|_| "rustc".into());
    let version = Command::new(&rustc)
        .arg("--version")
        .output()
        .ok()
        .filter(|output| output.status.success())
        .and_then(|output| String::from_utf8(output.stdout).ok())
        .map(|version| version.trim().to_string())
        .unwrap_or_else(|| "rustc (unknown version)".into());
    println!("cargo:rustc-env=BTOPRS_RUSTC_VERSION={version}");

    let profile = std::env::var("PROFILE").unwrap_or_else(|_| "unknown".into());
    let target = std::env::var("TARGET").unwrap_or_else(|_| "unknown".into());
    println!(
        "cargo:rustc-env=BTOPRS_BUILD_CONFIGURATION=profile={profile} target={target} no-external-crates"
    );
}