diff --git a/gnucash/gnucash-cli.cpp b/gnucash/gnucash-cli.cpp index 809e2230ff..153cb2d196 100644 --- a/gnucash/gnucash-cli.cpp +++ b/gnucash/gnucash-cli.cpp @@ -93,7 +93,7 @@ Gnucash::GnucashCli::parse_command_line (int argc, char **argv) void Gnucash::GnucashCli::configure_program_options (void) { - bpo::options_description quotes_options(_("Price Retrieval Options")); + bpo::options_description quotes_options(_("Price Quotes Retrieval Options")); quotes_options.add_options() ("add-price-quotes", bpo::bool_switch(), N_("Add price quotes to given GnuCash datafile.\n")) @@ -101,7 +101,7 @@ Gnucash::GnucashCli::configure_program_options (void) N_("Regular expression determining which namespace commodities will be retrieved")); m_opt_desc->add (quotes_options); - bpo::options_description report_options(_("Run Report Options")); + bpo::options_description report_options(_("Report Generation Options")); report_options.add_options() ("run-report", bpo::value(), N_("Runs a report\n")) diff --git a/gnucash/gnucash-commands.cpp b/gnucash/gnucash-commands.cpp index 61ee943181..39362ef9d0 100644 --- a/gnucash/gnucash-commands.cpp +++ b/gnucash/gnucash-commands.cpp @@ -36,6 +36,7 @@ extern "C" { #include #include #include +#include #include } @@ -44,13 +45,6 @@ extern "C" { namespace bl = boost::locale; -struct run_report_args { - const std::string& file_to_load; - const std::string& run_report; - const std::string& export_type; - const std::string& output_file; -}; - /* This static indicates the debugging module that this .o belongs to. */ static QofLogModule log_module = GNC_MOD_GUI; @@ -126,33 +120,38 @@ report_session_percentage (const char *message, double percent) return; } +struct run_report_args { + const std::string& file_to_load; + const std::string& run_report; + const std::string& export_type; + const std::string& output_file; +}; + static void scm_run_report (void *data, [[maybe_unused]] int argc, [[maybe_unused]] char **argv) { auto args = static_cast(data); - QofSession *session = NULL; - SCM cmdline, report, type, file; - const gchar *datafile; + QofSession *session = nullptr; scm_c_eval_string("(debug-set! stack 200000)"); scm_c_use_module ("gnucash utilities"); scm_c_use_module ("gnucash app-utils"); - scm_c_use_module ("gnucash report"); scm_c_use_module ("gnucash reports"); - // gnc_report_init (); + gnc_report_init (); // load_system_config(); // load_user_config(); gnc_prefs_init (); qof_event_suspend (); - datafile = args->file_to_load.c_str(); - cmdline = scm_c_eval_string ("gnc:cmdline-run-report"); - report = scm_from_utf8_string (args->run_report.c_str()); - - type = !args->export_type.empty() ? scm_from_utf8_string (args->export_type.c_str()) : SCM_BOOL_F; - file = !args->output_file.empty() ? scm_from_utf8_string (args->output_file.c_str()) : SCM_BOOL_F; + auto datafile = args->file_to_load.c_str(); + auto cmdline = scm_c_eval_string ("gnc:cmdline-run-report"); + auto report = scm_from_utf8_string (args->run_report.c_str()); + auto type = !args->export_type.empty() ? + scm_from_utf8_string (args->export_type.c_str()) : SCM_BOOL_F; + auto file = !args->output_file.empty() ? + scm_from_utf8_string (args->output_file.c_str()) : SCM_BOOL_F; /* dry-run? is #t: try report, check validity of options */ if (scm_is_false (scm_call_4 (cmdline, report, type, file, SCM_BOOL_T)))