@@ -34,6 +34,7 @@ use std::path::PathBuf;
3434crate struct ScrapeExamplesOptions {
3535 output_path : PathBuf ,
3636 target_crates : Vec < String > ,
37+ crate scrape_tests : bool ,
3738}
3839
3940impl ScrapeExamplesOptions {
@@ -43,16 +44,22 @@ impl ScrapeExamplesOptions {
4344 ) -> Result < Option < Self > , i32 > {
4445 let output_path = matches. opt_str ( "scrape-examples-output-path" ) ;
4546 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 {
4850 output_path : PathBuf :: from ( output_path) ,
4951 target_crates,
52+ scrape_tests,
5053 } ) ) ,
51- ( Some ( _) , false ) | ( None , true ) => {
54+ ( Some ( _) , false , _ ) | ( None , true , _ ) => {
5255 diag. err ( "must use --scrape-examples-output-path and --scrape-examples-target-crate together" ) ;
5356 Err ( 1 )
5457 }
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 ) ,
5663 }
5764 }
5865}
0 commit comments