| 2416 | namespace { |
| 2417 | |
| 2418 | void parseProgramOptions(int ac, char ** av, const std::string& exe, boost::program_options::variables_map& vm) |
| 2419 | { |
| 2420 | // Declare a group of options that will be |
| 2421 | // allowed only on the command line |
| 2422 | boost::program_options::options_description generic("Generic options"); |
| 2423 | generic.add_options() |
| 2424 | ("version,v", "Prints version string") |
| 2425 | ("verbose", "Prints verbose version string") |
| 2426 | ("help,h", "Prints help message") |
| 2427 | ("console,c", "Starts in console mode") |
| 2428 | ("response-file", boost::program_options::value<std::string>(),"Can be specified with '@name', too") |
| 2429 | ("dump-config", "Dumps configuration") |
| 2430 | ("get-config", boost::program_options::value<std::string>(), "Prints the value of the requested configuration key") |
| 2431 | ("set-config", boost::program_options::value< std::vector<std::string> >()->multitoken(), "Sets the value of a configuration key") |
| 2432 | ("keep-deprecated-paths", "If set then config files are kept on the old location") |
| 2433 | ; |
| 2434 | |
| 2435 | // Declare a group of options that will be |
| 2436 | // allowed both on the command line and in |
| 2437 | // the config file |
| 2438 | std::stringstream descr; |
| 2439 | descr << "Writes " << exe << ".log to the user directory."; |
| 2440 | boost::program_options::options_description config("Configuration"); |
| 2441 | config.add_options() |
| 2442 | ("write-log,l", descr.str().c_str()) |
| 2443 | ("log-file", boost::program_options::value<std::string>(), "Unlike --write-log this allows logging to an arbitrary file") |
| 2444 | ("user-cfg,u", boost::program_options::value<std::string>(),"User config file to load/save user settings") |
| 2445 | ("system-cfg,s", boost::program_options::value<std::string>(),"System config file to load/save system settings") |
| 2446 | ("run-test,t", boost::program_options::value<std::string>()->implicit_value(""),"Run a given test case (use 0 (zero) to run all tests). If no argument is provided then return list of all available tests.") |
| 2447 | ("run-open,r", boost::program_options::value<std::string>()->implicit_value(""),"Run a given test case (use 0 (zero) to run all tests). If no argument is provided then return list of all available tests. Keeps UI open after test(s) complete.") |
| 2448 | ("module-path,M", boost::program_options::value< std::vector<std::string> >()->composing(),"Additional module paths") |
| 2449 | ("macro-path,E", boost::program_options::value< std::vector<std::string> >()->composing(),"Additional macro paths") |
| 2450 | ("python-path,P", boost::program_options::value< std::vector<std::string> >()->composing(),"Additional python paths") |
| 2451 | ("disable-addon", boost::program_options::value< std::vector<std::string> >()->composing(),"Disable a given addon.") |
| 2452 | ("single-instance", "Allow to run a single instance of the application") |
| 2453 | ("safe-mode", "Force enable safe mode") |
| 2454 | ("pass", boost::program_options::value< std::vector<std::string> >()->multitoken(), "Ignores the following arguments and pass them through to be used by a script") |
| 2455 | ; |
| 2456 | |
| 2457 | |
| 2458 | // Hidden options, will be allowed both on the command line and |
| 2459 | // in the config file, but will not be shown to the user. |
| 2460 | boost::program_options::options_description hidden("Hidden options"); |
| 2461 | hidden.add_options() |
| 2462 | ("input-file", boost::program_options::value< std::vector<std::string> >(), "input file") |
| 2463 | ("output", boost::program_options::value<std::string>(),"output file") |
| 2464 | ("hidden", "don't show the main window") |
| 2465 | // this are to ignore for the window system (QApplication) |
| 2466 | ("style", boost::program_options::value< std::string >(), "set the application GUI style") |
| 2467 | ("stylesheet", boost::program_options::value< std::string >(), "set the application stylesheet") |
| 2468 | ("session", boost::program_options::value< std::string >(), "restore the application from an earlier session") |
| 2469 | ("reverse", "set the application's layout direction from right to left") |
| 2470 | ("widgetcount", "print debug messages about widgets") |
| 2471 | ("graphicssystem", boost::program_options::value< std::string >(), "backend to be used for on-screen widgets and pixmaps") |
| 2472 | ("display", boost::program_options::value< std::string >(), "set the X-Server") |
| 2473 | ("geometry ", boost::program_options::value< std::string >(), "set the X-Window geometry") |
| 2474 | ("font", boost::program_options::value< std::string >(), "set the X-Window font") |
| 2475 | ("fn", boost::program_options::value< std::string >(), "set the X-Window font") |