aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cli/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_cli/src/main.rs')
-rw-r--r--crates/ra_cli/src/main.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs
index a4debeb48..72e6ae4d5 100644
--- a/crates/ra_cli/src/main.rs
+++ b/crates/ra_cli/src/main.rs
@@ -1,3 +1,5 @@
1mod analysis_stats;
2
1use std::{fs, io::Read, path::Path, time::Instant}; 3use std::{fs, io::Read, path::Path, time::Instant};
2 4
3use clap::{App, Arg, SubCommand}; 5use clap::{App, Arg, SubCommand};
@@ -5,10 +7,12 @@ use join_to_string::join;
5use ra_ide_api_light::{extend_selection, file_structure, syntax_tree}; 7use ra_ide_api_light::{extend_selection, file_structure, syntax_tree};
6use ra_syntax::{SourceFile, TextRange, TreeArc, AstNode}; 8use ra_syntax::{SourceFile, TextRange, TreeArc, AstNode};
7use tools::collect_tests; 9use tools::collect_tests;
10use flexi_logger::Logger;
8 11
9type Result<T> = ::std::result::Result<T, failure::Error>; 12type Result<T> = ::std::result::Result<T, failure::Error>;
10 13
11fn main() -> Result<()> { 14fn main() -> Result<()> {
15 Logger::with_env().start()?;
12 let matches = App::new("ra-cli") 16 let matches = App::new("ra-cli")
13 .setting(clap::AppSettings::SubcommandRequiredElseHelp) 17 .setting(clap::AppSettings::SubcommandRequiredElseHelp)
14 .subcommand( 18 .subcommand(
@@ -23,6 +27,9 @@ fn main() -> Result<()> {
23 .arg(Arg::with_name("start")) 27 .arg(Arg::with_name("start"))
24 .arg(Arg::with_name("end")), 28 .arg(Arg::with_name("end")),
25 ) 29 )
30 .subcommand(
31 SubCommand::with_name("analysis-stats").arg(Arg::with_name("verbose").short("v")),
32 )
26 .get_matches(); 33 .get_matches();
27 match matches.subcommand() { 34 match matches.subcommand() {
28 ("parse", Some(matches)) => { 35 ("parse", Some(matches)) => {
@@ -56,6 +63,10 @@ fn main() -> Result<()> {
56 let sels = selections(&file, start, end); 63 let sels = selections(&file, start, end);
57 println!("{}", sels) 64 println!("{}", sels)
58 } 65 }
66 ("analysis-stats", Some(matches)) => {
67 let verbose = matches.is_present("verbose");
68 analysis_stats::run(verbose)?;
69 }
59 _ => unreachable!(), 70 _ => unreachable!(),
60 } 71 }
61 Ok(()) 72 Ok(())