aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cli/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-05-25 11:42:34 +0100
committerAleksey Kladov <[email protected]>2019-05-25 11:42:34 +0100
commitc6e905a79f7ba083b3f97728aa3a74fb0e03661b (patch)
tree606a17d688e931e35fe45eefd6c13c0baf7bd5bb /crates/ra_cli/src
parent9800699bab04e97996f0aebec528714165a2619b (diff)
Colorize Rust code as HTML
Diffstat (limited to 'crates/ra_cli/src')
-rw-r--r--crates/ra_cli/src/main.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs
index f11d0e6bd..93aba4c70 100644
--- a/crates/ra_cli/src/main.rs
+++ b/crates/ra_cli/src/main.rs
@@ -3,7 +3,7 @@ mod analysis_stats;
3use std::io::Read; 3use std::io::Read;
4 4
5use clap::{App, Arg, SubCommand}; 5use clap::{App, Arg, SubCommand};
6use ra_ide_api::file_structure; 6use ra_ide_api::{file_structure, Analysis};
7use ra_syntax::{SourceFile, TreeArc, AstNode}; 7use ra_syntax::{SourceFile, TreeArc, AstNode};
8use flexi_logger::Logger; 8use flexi_logger::Logger;
9use ra_prof::profile; 9use ra_prof::profile;
@@ -16,6 +16,7 @@ fn main() -> Result<()> {
16 .setting(clap::AppSettings::SubcommandRequiredElseHelp) 16 .setting(clap::AppSettings::SubcommandRequiredElseHelp)
17 .subcommand(SubCommand::with_name("parse").arg(Arg::with_name("no-dump").long("--no-dump"))) 17 .subcommand(SubCommand::with_name("parse").arg(Arg::with_name("no-dump").long("--no-dump")))
18 .subcommand(SubCommand::with_name("symbols")) 18 .subcommand(SubCommand::with_name("symbols"))
19 .subcommand(SubCommand::with_name("highlight"))
19 .subcommand( 20 .subcommand(
20 SubCommand::with_name("analysis-stats") 21 SubCommand::with_name("analysis-stats")
21 .arg(Arg::with_name("verbose").short("v").long("verbose")) 22 .arg(Arg::with_name("verbose").short("v").long("verbose"))
@@ -38,6 +39,11 @@ fn main() -> Result<()> {
38 println!("{:?}", s); 39 println!("{:?}", s);
39 } 40 }
40 } 41 }
42 ("highlight", _) => {
43 let (analysis, file_id) = Analysis::from_single_file(read_stdin()?);
44 let html = analysis.highlight_as_html(file_id).unwrap();
45 println!("{}", html);
46 }
41 ("analysis-stats", Some(matches)) => { 47 ("analysis-stats", Some(matches)) => {
42 let verbose = matches.is_present("verbose"); 48 let verbose = matches.is_present("verbose");
43 let path = matches.value_of("path").unwrap_or(""); 49 let path = matches.value_of("path").unwrap_or("");