ript-cli 0.1.6

Rust implementation of the InertiaJS protocol compatible with `riptc` for generating strong TypeScript bindings.
use toml_edit::DocumentMut;

// the nightly toolchain of the _workspace_, not this crate which is deliberately pinned to stable
// so that the cli can be `cargo install`ed on stable, and then boostrap the rest of the toolchain
// automatically.
// const RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
// TODO(@lazkindness): hack for now until i can get publishing working here :(
const RUST_TOOLCHAIN: &str = r#"
[toolchain]
channel = "nightly-2025-02-25"
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
profile = "minimal"

"#;

fn main() {
    println!("cargo::rerun-if-changed=build.rs");
    println!("cargo::rerun-if-changed=../rust-toolchain.toml");

    let rust_toolchain = RUST_TOOLCHAIN
        .parse::<DocumentMut>()
        .expect("Failed to parse `rust-toolchain.toml`.");

    let channel = rust_toolchain["toolchain"]["channel"]
        .as_str()
        .expect("Could not find `toolchain.channel` key in `rust-toolchain.toml`.");

    println!("cargo::rustc-env=RUST_TOOLCHAIN_CHANNEL={channel}");
}