From d1153f4457abe8f877207a685cdcafb93969bb5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Gouveia?= Date: Wed, 1 Jul 2026 13:19:24 +0000 Subject: [PATCH] Allow passing a specific directory to rule-preprocessor --- rule-preprocessor/src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rule-preprocessor/src/main.rs b/rule-preprocessor/src/main.rs index afd92a36..83fcd442 100644 --- a/rule-preprocessor/src/main.rs +++ b/rule-preprocessor/src/main.rs @@ -19,11 +19,13 @@ use semantic::SemanticAnalysis; use syntactic::SyntacticAnalysis; fn main() { - let out_dir = std::env::args() - .nth(1) - .expect("usage: rule-preprocessor "); + let mut args = std::env::args().skip(1); + let out_dir = args + .next() + .expect("usage: rule-preprocessor [rules-crate-dir]"); + let in_dir = args.next().unwrap_or_else(|| "../rules".to_string()); SemanticAnalysis::run(SyntacticAnalysis::run( - &std::fs::canonicalize("../rules").unwrap(), + &std::fs::canonicalize(&in_dir).unwrap(), )) .write_ir(&std::path::PathBuf::from(out_dir)); }