File tree 1 file changed +28
-24
lines changed
1 file changed +28
-24
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ fn parse_custom_attribute(
146
146
#[ allow( clippy:: doc_markdown) ]
147
147
struct BindgenCommand {
148
148
/// C or C++ header file.
149
- header : String ,
149
+ header : Option < String > ,
150
150
/// Path to write depfile to.
151
151
#[ arg( long) ]
152
152
depfile : Option < String > ,
@@ -657,6 +657,33 @@ where
657
657
clang_args,
658
658
} = command;
659
659
660
+ if let Some ( shell) = generate_shell_completions {
661
+ clap_complete:: generate (
662
+ shell,
663
+ & mut BindgenCommand :: command ( ) ,
664
+ "bindgen" ,
665
+ & mut io:: stdout ( ) ,
666
+ ) ;
667
+
668
+ exit ( 0 )
669
+ }
670
+
671
+ if version {
672
+ println ! (
673
+ "bindgen {}" ,
674
+ option_env!( "CARGO_PKG_VERSION" ) . unwrap_or( "unknown" )
675
+ ) ;
676
+ if verbose {
677
+ println ! ( "Clang: {}" , crate :: clang_version( ) . full) ;
678
+ }
679
+
680
+ exit ( 0 )
681
+ }
682
+
683
+ if header. is_none ( ) {
684
+ return Err ( io:: Error :: new ( io:: ErrorKind :: Other , "Header not found" ) ) ;
685
+ }
686
+
660
687
let mut builder = builder ( ) ;
661
688
662
689
#[ derive( Debug ) ]
@@ -804,31 +831,8 @@ where
804
831
}
805
832
}
806
833
807
- let header = Some ( header) ;
808
-
809
834
builder = apply_args ! (
810
835
builder {
811
- generate_shell_completions => |_, shell| {
812
- clap_complete:: generate(
813
- shell,
814
- & mut BindgenCommand :: command( ) ,
815
- "bindgen" ,
816
- & mut io:: stdout( ) ,
817
- ) ;
818
-
819
- exit( 0 )
820
- } ,
821
- version => |_, _| {
822
- println!(
823
- "bindgen {}" ,
824
- option_env!( "CARGO_PKG_VERSION" ) . unwrap_or( "unknown" )
825
- ) ;
826
- if verbose {
827
- println!( "Clang: {}" , crate :: clang_version( ) . full) ;
828
- }
829
-
830
- exit( 0 )
831
- } ,
832
836
header,
833
837
rust_target,
834
838
rust_edition,
You can’t perform that action at this time.
0 commit comments