|
3 | 3 | #![warn(rust_2018_idioms, unused_lifetimes)]
|
4 | 4 |
|
5 | 5 | use clap::{Arg, ArgAction, ArgMatches, Command, PossibleValue};
|
6 |
| -use clippy_dev::{bless, fmt, lint, new_lint, serve, setup, update_lints}; |
| 6 | +use clippy_dev::{bless, dogfood, fmt, lint, new_lint, serve, setup, update_lints}; |
7 | 7 | use indoc::indoc;
|
| 8 | + |
8 | 9 | fn main() {
|
9 | 10 | let matches = get_clap_config();
|
10 | 11 |
|
11 | 12 | match matches.subcommand() {
|
12 | 13 | Some(("bless", matches)) => {
|
13 | 14 | bless::bless(matches.contains_id("ignore-timestamp"));
|
14 | 15 | },
|
| 16 | + Some(("dogfood", matches)) => { |
| 17 | + dogfood::dogfood( |
| 18 | + matches.contains_id("fix"), |
| 19 | + matches.contains_id("allow-dirty"), |
| 20 | + matches.contains_id("allow-staged"), |
| 21 | + ); |
| 22 | + }, |
15 | 23 | Some(("fmt", matches)) => {
|
16 | 24 | fmt::run(matches.contains_id("check"), matches.contains_id("verbose"));
|
17 | 25 | },
|
@@ -98,6 +106,17 @@ fn get_clap_config() -> ArgMatches {
|
98 | 106 | .long("ignore-timestamp")
|
99 | 107 | .help("Include files updated before clippy was built"),
|
100 | 108 | ),
|
| 109 | + Command::new("dogfood").about("Runs the dogfood test").args([ |
| 110 | + Arg::new("fix").long("fix").help("Apply the suggestions when possible"), |
| 111 | + Arg::new("allow-dirty") |
| 112 | + .long("allow-dirty") |
| 113 | + .help("Fix code even if the working directory has changes") |
| 114 | + .requires("fix"), |
| 115 | + Arg::new("allow-staged") |
| 116 | + .long("allow-staged") |
| 117 | + .help("Fix code even if the working directory has staged changes") |
| 118 | + .requires("fix"), |
| 119 | + ]), |
101 | 120 | Command::new("fmt")
|
102 | 121 | .about("Run rustfmt on all projects and tests")
|
103 | 122 | .args([
|
|
0 commit comments