From 7e0dd7b9c129206865491ea80cf641e4cea37030 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Tue, 13 Feb 2024 15:52:34 -0500 Subject: [PATCH] feat(cli): add an optional `grammar-path` argument for the playground --- cli/src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index e9308628..085391ed 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -314,6 +314,11 @@ struct BuildWasm { struct Playground { #[arg(long, short, help = "Don't open in default browser")] pub quiet: bool, + #[arg( + long, + help = "Path to the directory containing the grammar and wasm files" + )] + pub grammar_path: Option, } #[derive(Args)] @@ -765,7 +770,11 @@ fn run() -> Result<()> { Commands::Playground(playground_options) => { let open_in_browser = !playground_options.quiet; - playground::serve(¤t_dir, open_in_browser)?; + let grammar_path = playground_options + .grammar_path + .map(PathBuf::from) + .unwrap_or(current_dir); + playground::serve(&grammar_path, open_in_browser)?; } Commands::DumpLanguages(_) => {