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 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 ( & [
@@ -545,9 +544,22 @@ where
545
544
Arg :: new ( "vtable-generation" )
546
545
. long ( "vtable-generation" )
547
546
. help ( "Enables generation of vtable functions." ) ,
547
+ Arg :: new ( "V" )
548
+ . long ( "version" )
549
+ . help ( "Prints the version, and exits" ) ,
548
550
] ) // .args()
549
551
. get_matches_from ( args) ;
550
552
553
+ let verbose = matches. is_present ( "verbose" ) ;
554
+
555
+ if matches. is_present ( "V" ) {
556
+ println ! ( "bindgen {}" , option_env!( "CARGO_PKG_VERSION" ) . unwrap_or( "unknown" ) ) ;
557
+ if verbose {
558
+ println ! ( "Clang version: {}" , crate :: clang_version( ) . full) ;
559
+ }
560
+ std:: process:: exit ( 0 ) ;
561
+ }
562
+
551
563
let mut builder = builder ( ) ;
552
564
553
565
if let Some ( header) = matches. value_of ( "header" ) {
@@ -1015,7 +1027,5 @@ where
1015
1027
builder = builder. vtable_generation ( true ) ;
1016
1028
}
1017
1029
1018
- let verbose = matches. is_present ( "verbose" ) ;
1019
-
1020
1030
Ok ( ( builder, output, verbose) )
1021
1031
}
You can’t perform that action at this time.
0 commit comments