@@ -34,6 +34,7 @@ use std::path::PathBuf;
34
34
crate struct ScrapeExamplesOptions {
35
35
output_path : PathBuf ,
36
36
target_crates : Vec < String > ,
37
+ crate scrape_tests : bool ,
37
38
}
38
39
39
40
impl ScrapeExamplesOptions {
@@ -43,16 +44,22 @@ impl ScrapeExamplesOptions {
43
44
) -> Result < Option < Self > , i32 > {
44
45
let output_path = matches. opt_str ( "scrape-examples-output-path" ) ;
45
46
let target_crates = matches. opt_strs ( "scrape-examples-target-crate" ) ;
46
- match ( output_path, !target_crates. is_empty ( ) ) {
47
- ( Some ( output_path) , true ) => Ok ( Some ( ScrapeExamplesOptions {
47
+ let scrape_tests = matches. opt_present ( "scrape-tests" ) ;
48
+ match ( output_path, !target_crates. is_empty ( ) , scrape_tests) {
49
+ ( Some ( output_path) , true , _) => Ok ( Some ( ScrapeExamplesOptions {
48
50
output_path : PathBuf :: from ( output_path) ,
49
51
target_crates,
52
+ scrape_tests,
50
53
} ) ) ,
51
- ( Some ( _) , false ) | ( None , true ) => {
54
+ ( Some ( _) , false , _ ) | ( None , true , _ ) => {
52
55
diag. err ( "must use --scrape-examples-output-path and --scrape-examples-target-crate together" ) ;
53
56
Err ( 1 )
54
57
}
55
- ( None , false ) => Ok ( None ) ,
58
+ ( None , false , true ) => {
59
+ diag. err ( "must use --scrape-examples-output-path and --scrape-examples-target-crate with --scrape-tests" ) ;
60
+ Err ( 1 )
61
+ }
62
+ ( None , false , false ) => Ok ( None ) ,
56
63
}
57
64
}
58
65
}
0 commit comments