feat(cli): add an optional grammar-path argument for the playground
This commit is contained in:
parent
51c147053e
commit
7e0dd7b9c1
1 changed files with 10 additions and 1 deletions
|
|
@ -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)]
|
||||
|
|
@ -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(_) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue