]> git.lizzy.rs Git - rust.git/blobdiff - clippy_dev/src/main.rs
clippy dev crater: address more review commetns
[rust.git] / clippy_dev / src / main.rs
index 4fdae38e3ab7a409f5cf7ca8c8fbbc3e27038b57..c47aabc2e0aa3b3e3ada087ada5deb5b89a1c28b 100644 (file)
@@ -3,12 +3,19 @@
 use clap::{App, Arg, ArgMatches, SubCommand};
 use clippy_dev::{bless, fmt, new_lint, ra_setup, serve, stderr_length_check, update_lints};
 
+#[cfg(feature = "crater")]
+use clippy_dev::crater;
+
 fn main() {
     let matches = get_clap_config();
 
     match matches.subcommand() {
-        ("bless", Some(_)) => {
-            bless::bless();
+        ("bless", Some(matches)) => {
+            bless::bless(matches.is_present("ignore-timestamp"));
+        },
+        #[cfg(feature = "crater")]
+        ("crater", Some(matches)) => {
+            crater::run(&matches);
         },
         ("fmt", Some(matches)) => {
             fmt::run(matches.is_present("check"), matches.is_present("verbose"));
@@ -46,8 +53,27 @@ fn main() {
 }
 
 fn get_clap_config<'a>() -> ArgMatches<'a> {
-    App::new("Clippy developer tooling")
-        .subcommand(SubCommand::with_name("bless").about("bless the test output changes"))
+    #[cfg(feature = "crater")]
+    let crater_sbcmd = SubCommand::with_name("crater")
+        .about("run clippy on a set of crates and check output")
+        .arg(
+            Arg::with_name("only")
+                .takes_value(true)
+                .value_name("CRATE")
+                .long("only")
+                .help("only process a single crate of the list"),
+        );
+
+    let app = App::new("Clippy developer tooling")
+        .subcommand(
+            SubCommand::with_name("bless")
+                .about("bless the test output changes")
+                .arg(
+                    Arg::with_name("ignore-timestamp")
+                        .long("ignore-timestamp")
+                        .help("Include files updated before clippy was built"),
+                ),
+        )
         .subcommand(
             SubCommand::with_name("fmt")
                 .about("Run rustfmt on all projects and tests")
@@ -155,6 +181,10 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
                         .validator_os(serve::validate_port),
                 )
                 .arg(Arg::with_name("lint").help("Which lint's page to load initially (optional)")),
-        )
-        .get_matches()
+        );
+
+    #[cfg(feature = "crater")]
+    let app = app.subcommand(crater_sbcmd);
+
+    app.get_matches()
 }