summaryrefslogtreecommitdiff
path: root/src/options.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/options.rs')
-rw-r--r--src/options.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/options.rs b/src/options.rs
index b3ddbbfd..9405aff9 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -1,4 +1,4 @@
-use bindgen::{Builder, CodegenConfig, RUST_TARGET_STRINGS, RustTarget, builder};
+use bindgen::{Builder, CodegenConfig, RUST_TARGET_STRINGS, RustTarget, builder, EnumVariation};
use clap::{App, Arg};
use std::fs::File;
use std::io::{self, Error, ErrorKind, Write, stderr};
@@ -26,6 +26,13 @@ where
Arg::with_name("header")
.help("C or C++ header file")
.required(true),
+ Arg::with_name("default-enum-variant")
+ .long("default-enum-variant")
+ .help("choose one")
+ .value_name("variant")
+ .default_value("consts")
+ .possible_values(&["consts", "moduleconsts", "bitfield", "rust"])
+ .multiple(false),
Arg::with_name("bitfield-enum")
.long("bitfield-enum")
.help("Mark any enum whose name matches <regex> as a set of \
@@ -303,6 +310,10 @@ where
builder = builder.rust_target(RustTarget::from_str(rust_target)?);
}
+ if let Some(variant) = matches.value_of("default-enum-variant") {
+ builder = builder.default_enum_variant(EnumVariation::from_str(variant)?)
+ }
+
if let Some(bitfields) = matches.values_of("bitfield-enum") {
for regex in bitfields {
builder = builder.bitfield_enum(regex);