aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-01-07 13:11:18 +0000
committerAleksey Kladov <[email protected]>2020-01-07 13:11:18 +0000
commitb02576d5623478526328b4716b1fd9c5c2efd637 (patch)
tree82f6b3f6ac1097c9266dc473ed10978381530094 /xtask
parent8f1792fde233799fe3335032834ee7281d78e55b (diff)
Simplify
help for internal tools does not worth the duplication
Diffstat (limited to 'xtask')
-rw-r--r--xtask/src/help.rs13
-rw-r--r--xtask/src/main.rs36
2 files changed, 4 insertions, 45 deletions
diff --git a/xtask/src/help.rs b/xtask/src/help.rs
index f4e25dcde..9c78ba37f 100644
--- a/xtask/src/help.rs
+++ b/xtask/src/help.rs
@@ -27,19 +27,6 @@ FLAGS:
27 --jemalloc 27 --jemalloc
28 --server"; 28 --server";
29 29
30pub fn print_no_param_subcommand_help(subcommand: &str) {
31 eprintln!(
32 "ra_tools-{}
33
34USAGE:
35 ra_tools {}
36
37FLAGS:
38 -h, --help Prints help information",
39 subcommand, subcommand
40 );
41}
42
43pub const INSTALL_RA_CONFLICT: &str = 30pub const INSTALL_RA_CONFLICT: &str =
44 "error: The argument `--server` cannot be used with `--client-code` 31 "error: The argument `--server` cannot be used with `--client-code`
45 32
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index 9cefad925..b42946a4c 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -70,42 +70,14 @@ fn main() -> Result<()> {
70 install(opts)? 70 install(opts)?
71 } 71 }
72 "codegen" => { 72 "codegen" => {
73 if matches.contains(["-h", "--help"]) {
74 help::print_no_param_subcommand_help(&subcommand);
75 return Ok(());
76 }
77 codegen::generate_syntax(Mode::Overwrite)?; 73 codegen::generate_syntax(Mode::Overwrite)?;
78 codegen::generate_parser_tests(Mode::Overwrite)?; 74 codegen::generate_parser_tests(Mode::Overwrite)?;
79 codegen::generate_assists_docs(Mode::Overwrite)?; 75 codegen::generate_assists_docs(Mode::Overwrite)?;
80 } 76 }
81 "format" => { 77 "format" => run_rustfmt(Mode::Overwrite)?,
82 if matches.contains(["-h", "--help"]) { 78 "install-pre-commit-hook" => install_pre_commit_hook()?,
83 help::print_no_param_subcommand_help(&subcommand); 79 "lint" => run_clippy()?,
84 return Ok(()); 80 "fuzz-tests" => run_fuzzer()?,
85 }
86 run_rustfmt(Mode::Overwrite)?
87 }
88 "install-pre-commit-hook" => {
89 if matches.contains(["-h", "--help"]) {
90 help::print_no_param_subcommand_help(&subcommand);
91 return Ok(());
92 }
93 install_pre_commit_hook()?
94 }
95 "lint" => {
96 if matches.contains(["-h", "--help"]) {
97 help::print_no_param_subcommand_help(&subcommand);
98 return Ok(());
99 }
100 run_clippy()?
101 }
102 "fuzz-tests" => {
103 if matches.contains(["-h", "--help"]) {
104 help::print_no_param_subcommand_help(&subcommand);
105 return Ok(());
106 }
107 run_fuzzer()?
108 }
109 _ => eprintln!("{}", help::GLOBAL_HELP), 81 _ => eprintln!("{}", help::GLOBAL_HELP),
110 } 82 }
111 Ok(()) 83 Ok(())