aboutsummaryrefslogtreecommitdiff
path: root/crates/tools/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/tools/src/main.rs')
-rw-r--r--crates/tools/src/main.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/crates/tools/src/main.rs b/crates/tools/src/main.rs
index 36a7c83e2..9e90ac5c2 100644
--- a/crates/tools/src/main.rs
+++ b/crates/tools/src/main.rs
@@ -7,7 +7,7 @@ use std::{
7use clap::{App, Arg, SubCommand}; 7use clap::{App, Arg, SubCommand};
8use failure::bail; 8use failure::bail;
9 9
10use tools::{collect_tests, generate, run, run_rustfmt, Mode, Overwrite, Result, Test, Verify}; 10use tools::{collect_tests, generate, install_format_hook, run, run_rustfmt, Mode, Overwrite, Result, Test, Verify};
11 11
12const GRAMMAR_DIR: &str = "./crates/ra_syntax/src/grammar"; 12const GRAMMAR_DIR: &str = "./crates/ra_syntax/src/grammar";
13const INLINE_TESTS_DIR: &str = "./crates/ra_syntax/tests/data/parser/inline"; 13const INLINE_TESTS_DIR: &str = "./crates/ra_syntax/tests/data/parser/inline";
@@ -25,17 +25,22 @@ fn main() -> Result<()> {
25 .subcommand(SubCommand::with_name("gen-tests")) 25 .subcommand(SubCommand::with_name("gen-tests"))
26 .subcommand(SubCommand::with_name("install-code")) 26 .subcommand(SubCommand::with_name("install-code"))
27 .subcommand(SubCommand::with_name("format")) 27 .subcommand(SubCommand::with_name("format"))
28 .subcommand(SubCommand::with_name("format-hook"))
28 .get_matches(); 29 .get_matches();
29 let mode = if matches.is_present("verify") { 30 let mode = if matches.is_present("verify") {
30 Verify 31 Verify
31 } else { 32 } else {
32 Overwrite 33 Overwrite
33 }; 34 };
34 match matches.subcommand() { 35 match matches
35 ("install-code", _) => install_code_extension()?, 36 .subcommand_name()
36 ("gen-tests", _) => gen_tests(mode)?, 37 .expect("Subcommand must be specified")
37 ("gen-syntax", _) => generate(Overwrite)?, 38 {
38 ("format", _) => run_rustfmt(Overwrite)?, 39 "install-code" => install_code_extension()?,
40 "gen-tests" => gen_tests(mode)?,
41 "gen-syntax" => generate(Overwrite)?,
42 "format" => run_rustfmt(mode)?,
43 "format-hook" => install_format_hook()?,
39 _ => unreachable!(), 44 _ => unreachable!(),
40 } 45 }
41 Ok(()) 46 Ok(())