12 static int joedb_to_json(Arguments &arguments)
15 const bool base64 = arguments.has_flag(
"base64");
16 const std::string_view file_name = arguments.get_next(
"file.joedb");
18 if (arguments.missing())
20 arguments.print_help(std::cerr);
25 Readonly_Journal journal(file);
27 journal.replay_log(db);
28 const int error =
write_json(std::cout, db, base64);
31 std::cerr <<
"warning: a string could not be encoded. Maybe you should use --base64 instead.\n";
34 std::cerr <<
"warning: inf or nan value encoded as 0. JSON does not support inf and nan.\n";
41int main(
int argc,
char **argv)
@ read_existing
fails if does not exist
int main_wrapper(int(*main)(Arguments &), int argc, char **argv)
Process command-line arguments and catch exceptions from main.
int write_json(std::ostream &out, const Readable &db, bool base64)