help for internal tools does not worth the duplication
This commit is contained in:
Aleksey Kladov 2020-01-07 14:11:18 +01:00
parent 8f1792fde2
commit b02576d562
2 changed files with 4 additions and 45 deletions

View file

@ -27,19 +27,6 @@ FLAGS:
--jemalloc
--server";
pub fn print_no_param_subcommand_help(subcommand: &str) {
eprintln!(
"ra_tools-{}
USAGE:
ra_tools {}
FLAGS:
-h, --help Prints help information",
subcommand, subcommand
);
}
pub const INSTALL_RA_CONFLICT: &str =
"error: The argument `--server` cannot be used with `--client-code`

View file

@ -70,42 +70,14 @@ fn main() -> Result<()> {
install(opts)?
}
"codegen" => {
if matches.contains(["-h", "--help"]) {
help::print_no_param_subcommand_help(&subcommand);
return Ok(());
}
codegen::generate_syntax(Mode::Overwrite)?;
codegen::generate_parser_tests(Mode::Overwrite)?;
codegen::generate_assists_docs(Mode::Overwrite)?;
}
"format" => {
if matches.contains(["-h", "--help"]) {
help::print_no_param_subcommand_help(&subcommand);
return Ok(());
}
run_rustfmt(Mode::Overwrite)?
}
"install-pre-commit-hook" => {
if matches.contains(["-h", "--help"]) {
help::print_no_param_subcommand_help(&subcommand);
return Ok(());
}
install_pre_commit_hook()?
}
"lint" => {
if matches.contains(["-h", "--help"]) {
help::print_no_param_subcommand_help(&subcommand);
return Ok(());
}
run_clippy()?
}
"fuzz-tests" => {
if matches.contains(["-h", "--help"]) {
help::print_no_param_subcommand_help(&subcommand);
return Ok(());
}
run_fuzzer()?
}
"format" => run_rustfmt(Mode::Overwrite)?,
"install-pre-commit-hook" => install_pre_commit_hook()?,
"lint" => run_clippy()?,
"fuzz-tests" => run_fuzzer()?,
_ => eprintln!("{}", help::GLOBAL_HELP),
}
Ok(())