File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 23
23
) ;
24
24
25
25
let matches = App :: new ( "bindgen" )
26
- . version ( option_env ! ( "CARGO_PKG_VERSION" ) . unwrap_or ( "unknown" ) )
27
26
. about ( "Generates Rust bindings from C/C++ headers." )
28
27
. override_usage ( "bindgen [FLAGS] [OPTIONS] <header> -- <clang-args>..." )
29
28
. args ( & [
@@ -534,9 +533,22 @@ where
534
533
Arg :: new ( "explicit-padding" )
535
534
. long ( "explicit-padding" )
536
535
. help ( "Always output explicit padding fields." ) ,
536
+ Arg :: new ( "V" )
537
+ . long ( "version" )
538
+ . help ( "Prints the version, and exits" ) ,
537
539
] ) // .args()
538
540
. get_matches_from ( args) ;
539
541
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
+
540
552
let mut builder = builder ( ) ;
541
553
542
554
if let Some ( header) = matches. value_of ( "header" ) {
@@ -994,7 +1006,5 @@ where
994
1006
builder = builder. explicit_padding ( true ) ;
995
1007
}
996
1008
997
- let verbose = matches. is_present ( "verbose" ) ;
998
-
999
1009
Ok ( ( builder, output, verbose) )
1000
1010
}
You can’t perform that action at this time.
0 commit comments