Skip to content

Commit

Permalink
feat(cli): add an optional grammar-path argument for the playground
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Feb 13, 2024
1 parent 51c1470 commit 4e3026a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
}

#[derive(Args)]
Expand Down Expand Up @@ -765,7 +770,11 @@ fn run() -> Result<()> {

Commands::Playground(playground_options) => {
let open_in_browser = !playground_options.quiet;
playground::serve(&current_dir, open_in_browser)?;
let grammar_path = playground_options
.grammar_path
.map(PathBuf::from)
.unwrap_or_else(|| current_dir.clone());
playground::serve(&grammar_path, open_in_browser)?;
}

Commands::DumpLanguages(_) => {
Expand Down

0 comments on commit 4e3026a

Please sign in to comment.