about summary refs log tree commit diff
path: root/clippy_dev/src/main.rs
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2020-10-08 05:18:22 -0700
committerDavid Tolnay <dtolnay@gmail.com>2020-10-08 06:43:02 -0700
commite6a71066c8e9c0aaaabd10923f73c81285b16932 (patch)
tree9ac7da85e5e237561896ac4bde9cdebdd6a662ad /clippy_dev/src/main.rs
parent171ab9bf9f55fefd4905f2100154228e90da3bf4 (diff)
downloadrust-e6a71066c8e9c0aaaabd10923f73c81285b16932.tar.gz
rust-e6a71066c8e9c0aaaabd10923f73c81285b16932.zip
Clippy dev subcommand to build and serve website
Diffstat (limited to 'clippy_dev/src/main.rs')
-rw-r--r--clippy_dev/src/main.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/clippy_dev/src/main.rs b/clippy_dev/src/main.rs
index 281037ae37c..7a8cbd5251d 100644
--- a/clippy_dev/src/main.rs
+++ b/clippy_dev/src/main.rs
@@ -1,7 +1,7 @@
 #![cfg_attr(feature = "deny-warnings", deny(warnings))]
 
 use clap::{App, Arg, SubCommand};
-use clippy_dev::{fmt, new_lint, ra_setup, stderr_length_check, update_lints};
+use clippy_dev::{fmt, new_lint, ra_setup, serve, stderr_length_check, update_lints};
 
 fn main() {
     let matches = App::new("Clippy developer tooling")
@@ -100,6 +100,19 @@ fn main() {
                         .required(true),
                 ),
         )
+        .subcommand(
+            SubCommand::with_name("serve")
+                .about("Launch a local 'ALL the Clippy Lints' website in a browser")
+                .arg(
+                    Arg::with_name("port")
+                        .long("port")
+                        .short("p")
+                        .help("Local port for the http server")
+                        .default_value("8000")
+                        .validator_os(serve::validate_port),
+                )
+                .arg(Arg::with_name("lint").help("Which lint's page to load initially (optional)")),
+        )
         .get_matches();
 
     match matches.subcommand() {
@@ -129,6 +142,11 @@ fn main() {
             stderr_length_check::check();
         },
         ("ra-setup", Some(matches)) => ra_setup::run(matches.value_of("rustc-repo-path")),
+        ("serve", Some(matches)) => {
+            let port = matches.value_of("port").unwrap().parse().unwrap();
+            let lint = matches.value_of("lint");
+            serve::run(port, lint);
+        },
         _ => {},
     }
 }