thanix 1.1.0

A yaml-to-rust code generator for generating Rust code from yaml config files e.g. as found in openAPI.
mod bindgen;
mod pathgen;
mod structgen;
mod util;

use std::path::PathBuf;

use clap::Parser;

/// The arguments that Thanix expects to get given via the cli.
#[derive(Parser, Debug)]
#[command(author, version, about, long_about=None)]
struct Args {
    #[arg(short, long, default_value = "output")]
    output: PathBuf,
    /// Path to a YAML schema file.
    input: Option<String>,
    /// Enable Workaround mode.
    /// Makes all response struct fields optional to guard against unsanitary response data
    /// where the API returns null for fields the schema marks as non-nullable.
    #[arg(short, long, action = clap::ArgAction::SetTrue)]
    workaround: bool,
    /// Prefix used for PATCH request schema names.
    /// Schemas with this prefix will have all fields made optional.
    /// Defaults to "Patched" (NetBox convention).
    #[arg(long, default_value = "Patched")]
    patch_prefix: String,
}

fn main() {
    let args: Args = Args::parse();

    // Welcome Message
    println!(
        "{} \n(c) The Nazara Project. (github.com/The-Nazara-Project)\n
        Licensed under the terms of the GPL-v3.0-License.\n\
        Check github.com/The-Nazara-Project/Thanix/LICENSE for more info.\n",
        include_str!("templates/ascii_art.template")
    );

    match args.input {
        Some(file) => bindgen::generate(file, args.output, args.workaround, &args.patch_prefix),
        None => println!("Error: You need to provide a YAML schema to generate from."),
    }
}