File tree Expand file tree Collapse file tree 1 file changed +28
-24
lines changed Expand file tree Collapse file tree 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(
146146#[ allow( clippy:: doc_markdown) ]  
147147struct  BindgenCommand  { 
148148    /// C or C++ header file. 
149-      header :  String , 
149+      header :  Option < String > , 
150150    /// Path to write depfile to. 
151151     #[ arg( long) ]  
152152    depfile :  Option < String > , 
@@ -657,6 +657,33 @@ where
657657        clang_args, 
658658    }  = command; 
659659
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+ 
660687    let  mut  builder = builder ( ) ; 
661688
662689    #[ derive( Debug ) ]  
@@ -804,31 +831,8 @@ where
804831        } 
805832    } 
806833
807-     let  header = Some ( header) ; 
808- 
809834    builder = apply_args ! ( 
810835        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-             } , 
832836            header, 
833837            rust_target, 
834838            rust_edition, 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments