Skip to content

Commit fa9358c

Browse files
committed
fix(args): make header argument optional
fixes rust-lang#2677
1 parent 6666724 commit fa9358c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bindgen-cli/options.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use clap::error::{Error, ErrorKind};
88
use clap::{CommandFactory, Parser};
99
use std::fs::File;
1010
use std::io;
11+
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
1112
use std::path::{Path, PathBuf};
1213
use std::process::exit;
1314

@@ -95,7 +96,7 @@ fn parse_custom_derive(
9596
)]
9697
struct BindgenCommand {
9798
/// C or C++ header file.
98-
header: String,
99+
header: Option<String>,
99100
/// Path to write depfile to.
100101
#[arg(long)]
101102
depfile: Option<String>,
@@ -589,7 +590,11 @@ where
589590

590591
let mut builder = builder();
591592

592-
builder = builder.header(header);
593+
if let Some(header) = header {
594+
builder = builder.header(header);
595+
} else {
596+
return Err(IoError::new(IoErrorKind::Other, "Header not found"));
597+
}
593598

594599
if let Some(rust_target) = rust_target {
595600
builder = builder.rust_target(rust_target);

0 commit comments

Comments
 (0)