File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 2323 ) ;
2424
2525 let matches = App :: new ( "bindgen" )
26- . version ( option_env ! ( "CARGO_PKG_VERSION" ) . unwrap_or ( "unknown" ) )
2726 . about ( "Generates Rust bindings from C/C++ headers." )
2827 . override_usage ( "bindgen [FLAGS] [OPTIONS] <header> -- <clang-args>..." )
2928 . args ( & [
@@ -534,9 +533,22 @@ where
534533 Arg :: new ( "explicit-padding" )
535534 . long ( "explicit-padding" )
536535 . help ( "Always output explicit padding fields." ) ,
536+ Arg :: new ( "V" )
537+ . long ( "version" )
538+ . help ( "Prints the version, and exits" ) ,
537539 ] ) // .args()
538540 . get_matches_from ( args) ;
539541
542+ let verbose = matches. is_present ( "verbose" ) ;
543+
544+ if matches. is_present ( "V" ) {
545+ println ! ( "bindgen {}" , option_env!( "CARGO_PKG_VERSION" ) . unwrap_or( "unknown" ) ) ;
546+ if verbose {
547+ println ! ( "Clang version: {}" , crate :: clang_version( ) . full) ;
548+ }
549+ std:: process:: exit ( 0 ) ;
550+ }
551+
540552 let mut builder = builder ( ) ;
541553
542554 if let Some ( header) = matches. value_of ( "header" ) {
@@ -994,7 +1006,5 @@ where
9941006 builder = builder. explicit_padding ( true ) ;
9951007 }
9961008
997- let verbose = matches. is_present ( "verbose" ) ;
998-
9991009 Ok ( ( builder, output, verbose) )
10001010}
You can’t perform that action at this time.
0 commit comments