Hook up debug to the CLI

This commit is contained in:
Alex Crichton
2017-12-20 12:50:10 -08:00
parent b548239e02
commit f1d425b943

View File

@ -19,6 +19,7 @@ Options:
--output-ts FILE Output TypeScript file --output-ts FILE Output TypeScript file
--output-wasm FILE Output WASM file --output-wasm FILE Output WASM file
--nodejs Generate output for node.js, not the browser --nodejs Generate output for node.js, not the browser
--debug Include otherwise-extraneous debug checks in output
"; ";
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
@ -26,6 +27,7 @@ struct Args {
flag_output_ts: Option<PathBuf>, flag_output_ts: Option<PathBuf>,
flag_output_wasm: Option<PathBuf>, flag_output_wasm: Option<PathBuf>,
flag_nodejs: bool, flag_nodejs: bool,
flag_debug: bool,
arg_input: PathBuf, arg_input: PathBuf,
} }
@ -37,6 +39,7 @@ fn main() {
let mut b = Bindgen::new(); let mut b = Bindgen::new();
b.input_path(&args.arg_input); b.input_path(&args.arg_input);
b.nodejs(args.flag_nodejs); b.nodejs(args.flag_nodejs);
b.debug(args.flag_debug);
let ret = b.generate().expect("failed to generate bindings"); let ret = b.generate().expect("failed to generate bindings");
if let Some(ref ts) = args.flag_output_ts { if let Some(ref ts) = args.flag_output_ts {
ret.write_ts_to(ts).expect("failed to write TypeScript output file"); ret.write_ts_to(ts).expect("failed to write TypeScript output file");