thag_rs 0.2.1

A versatile cross-platform playground and REPL for Rust snippets, expressions and programs. Accepts a script file or dynamic options.
Documentation
use clap::Parser;

/// GPT-generated CLI using the `clap` crate.
//# Purpose: Demonstrate `clap` CLI using the derive option.
//# Categories: CLI, crates, technique
//# Sample arguments: `-- -bgtv dummy_script.rs`

// Script Runner
#[derive(Debug, Parser)]
#[clap(version = "1.0", author = "Your Name")]
struct Opt {
    /// Sets the script to run
    script: String,
    /// Sets the arguments for the script
    #[clap(last = true)]
    args: Vec<String>,
    /// Sets the level of verbosity
    #[clap(short, long)]
    verbose: bool,
    /// Displays timings
    #[clap(short, long)]
    timings: bool,
    /// Generates something
    #[clap(short, long)]
    generate: bool,
    /// Builds something
    #[clap(short, long)]
    build: bool,
}

fn main() {
    let opt = Opt::parse();

    if opt.verbose {
        println!("Verbosity enabled");
    }

    if opt.timings {
        println!("Timings enabled");
    }

    if opt.generate {
        println!("Generating something");
    }

    if opt.build {
        println!("Building something");
    }

    println!("Running script: {}", opt.script);
    if !opt.args.is_empty() {
        println!("With arguments:");
        for arg in &opt.args {
            println!("{}", arg);
        }
    }
}