+ };
+ if args.dump_input {
+ Output::Info(Info::DumpInput(&function)).write_to_stdout(args.pretty)?;
+ }
+ todo!()
+ })
+}
+
+fn arbitrary_input(input_bytes: &[u8]) -> arbitrary::Result<Value> {
+ GlobalState::scope(|| -> arbitrary::Result<Value> {
+ Ok(
+ serde_json::to_value(FnFields::arbitrary_take_rest(Unstructured::new(
+ &input_bytes,
+ ))?)
+ .expect("serialization shouldn't ever fail"),
+ )
+ })
+}
+
+fn main() -> Result<ExitCode> {
+ let args = Args::parse();
+ let Args {
+ dump_input: _,
+ pretty,
+ arbitrary,
+ } = args;
+ let stdin = std::io::stdin().lock();
+ let mut exit_code = ExitCode::SUCCESS;
+ if arbitrary {
+ let mut input_bytes = vec![];
+ stdin.take(0x10000).read_to_end(&mut input_bytes)?;
+ if let Ok(input) = arbitrary_input(&input_bytes) {
+ process_input(&args, input, &mut exit_code)?;
+ } else {
+ Output::NeedDifferentInput.write_to_stdout(pretty)?;
+ exit_code = ExitCode::FAILURE;
+ };
+ } else {
+ for input in Deserializer::from_reader(stdin).into_iter::<Value>() {
+ process_input(&args, input?, &mut exit_code)?;
+ }