This commit is contained in:
2025-06-15 21:27:21 +02:00
parent bb39f3e3f2
commit 29a06d2bb4
3 changed files with 26 additions and 29 deletions

View File

@@ -3,32 +3,23 @@
//! This is the main entry point for the herodo binary.
//! It parses command line arguments and calls into the implementation in the cmd module.
use clap::{App, Arg};
use env_logger;
use std::env;
use std::process;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize the logger
env_logger::init();
// Parse command line arguments
let matches = App::new("herodo")
.version("0.1.0")
.author("SAL Team")
.about("Executes Rhai scripts for SAL")
.arg(
Arg::with_name("path")
.short("p")
.long("path")
.value_name("PATH")
.help("Path to a Rhai script file or directory containing Rhai scripts")
.required(true)
.takes_value(true),
)
.get_matches();
// Get the script path from arguments
let script_path = matches.value_of("path").unwrap();
let args: Vec<String> = env::args().collect();
if args.len() != 2 {
eprintln!("Usage: {} <script_path>", args[0]);
process::exit(1);
}
let script_path = &args[1];
// Call the run function from the cmd module
sal::cmd::herodo::run(script_path)
}