promocrypt-cli 1.1.0

Command-line tool for promotional code generation
//! Build script to set the core library version as an environment variable.

fn main() {
    // Read core version from Cargo.toml
    let core_version = std::fs::read_to_string("../core/Cargo.toml")
        .ok()
        .and_then(|content| {
            content
                .lines()
                .find(|line| line.starts_with("version"))
                .and_then(|line| line.split('"').nth(1).map(|v| v.to_string()))
        })
        .unwrap_or_else(|| "unknown".to_string());

    println!("cargo::rustc-env=CORE_VERSION={}", core_version);

    // Re-run if core Cargo.toml changes
    println!("cargo::rerun-if-changed=../core/Cargo.toml");
}