mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
allow to specify path in analysis-stats
This commit is contained in:
parent
940c538ecf
commit
915489714b
2 changed files with 6 additions and 4 deletions
|
@ -7,9 +7,9 @@ use ra_syntax::AstNode;
|
||||||
|
|
||||||
use crate::Result;
|
use crate::Result;
|
||||||
|
|
||||||
pub fn run(verbose: bool, only: Option<&str>) -> Result<()> {
|
pub fn run(verbose: bool, path: &str, only: Option<&str>) -> Result<()> {
|
||||||
let db_load_time = Instant::now();
|
let db_load_time = Instant::now();
|
||||||
let (db, roots) = BatchDatabase::load_cargo(".")?;
|
let (db, roots) = BatchDatabase::load_cargo(path)?;
|
||||||
println!("Database loaded, {} roots, {:?}", roots.len(), db_load_time.elapsed());
|
println!("Database loaded, {} roots, {:?}", roots.len(), db_load_time.elapsed());
|
||||||
let analysis_time = Instant::now();
|
let analysis_time = Instant::now();
|
||||||
let mut num_crates = 0;
|
let mut num_crates = 0;
|
||||||
|
|
|
@ -25,7 +25,8 @@ fn main() -> Result<()> {
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("analysis-stats")
|
SubCommand::with_name("analysis-stats")
|
||||||
.arg(Arg::with_name("verbose").short("v"))
|
.arg(Arg::with_name("verbose").short("v"))
|
||||||
.arg(Arg::with_name("only").short("o").takes_value(true)),
|
.arg(Arg::with_name("only").short("o").takes_value(true))
|
||||||
|
.arg(Arg::with_name("path")),
|
||||||
)
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
match matches.subcommand() {
|
match matches.subcommand() {
|
||||||
|
@ -53,8 +54,9 @@ fn main() -> Result<()> {
|
||||||
}
|
}
|
||||||
("analysis-stats", Some(matches)) => {
|
("analysis-stats", Some(matches)) => {
|
||||||
let verbose = matches.is_present("verbose");
|
let verbose = matches.is_present("verbose");
|
||||||
|
let path = matches.value_of("path").unwrap_or("");
|
||||||
let only = matches.value_of("only");
|
let only = matches.value_of("only");
|
||||||
analysis_stats::run(verbose, only)?;
|
analysis_stats::run(verbose, path, only)?;
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue