add diagnostics subcommand to rust-analyzer CLI
This commit is contained in:
@@ -35,6 +35,10 @@ pub(crate) enum Command {
|
||||
what: BenchWhat,
|
||||
load_output_dirs: bool,
|
||||
},
|
||||
Diagnostics {
|
||||
path: PathBuf,
|
||||
load_output_dirs: bool,
|
||||
},
|
||||
RunServer,
|
||||
Version,
|
||||
}
|
||||
@@ -209,6 +213,36 @@ ARGS:
|
||||
let load_output_dirs = matches.contains("--load-output-dirs");
|
||||
Command::Bench { path, what, load_output_dirs }
|
||||
}
|
||||
"diagnostics" => {
|
||||
if matches.contains(["-h", "--help"]) {
|
||||
eprintln!(
|
||||
"\
|
||||
ra-cli-diagnostics
|
||||
|
||||
USAGE:
|
||||
rust-analyzer diagnostics [FLAGS] [PATH]
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
--load-output-dirs Load OUT_DIR values by running `cargo check` before analysis
|
||||
|
||||
ARGS:
|
||||
<PATH>"
|
||||
);
|
||||
return Ok(Err(HelpPrinted));
|
||||
}
|
||||
|
||||
let load_output_dirs = matches.contains("--load-output-dirs");
|
||||
let path = {
|
||||
let mut trailing = matches.free()?;
|
||||
if trailing.len() != 1 {
|
||||
bail!("Invalid flags");
|
||||
}
|
||||
trailing.pop().unwrap().into()
|
||||
};
|
||||
|
||||
Command::Diagnostics { path, load_output_dirs }
|
||||
}
|
||||
_ => {
|
||||
eprintln!(
|
||||
"\
|
||||
|
||||
@@ -39,6 +39,10 @@ fn main() -> Result<()> {
|
||||
cli::analysis_bench(args.verbosity, path.as_ref(), what, load_output_dirs)?
|
||||
}
|
||||
|
||||
args::Command::Diagnostics { path, load_output_dirs } => {
|
||||
cli::diagnostics(path.as_ref(), load_output_dirs)?
|
||||
}
|
||||
|
||||
args::Command::RunServer => run_server()?,
|
||||
args::Command::Version => println!("rust-analyzer {}", env!("REV")),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user