- } else if (not strcmp(argv[i], "--version")) {
- printf("%s\n", SIMGRID_VERSION_STRING);
- shall_exit = 1;
- } else if (not strcmp(argv[i], "--cfg-help") || not strcmp(argv[i], "--help")) {
- printf("Description of the configuration accepted by this simulator:\n");
- xbt_cfg_help();
- printf(
- "\n"
- "Each of these configurations can be used by adding\n"
- " --cfg=<option name>:<option value>\n"
- "to the command line.\n"
- "\n"
- "For more information, please refer to:\n"
- " --help-aliases for the list of all option aliases.\n"
- " --help-logs and --help-log-categories for the details of logging output.\n"
- " --help-models for a list of all models known by this simulator.\n"
- " --help-tracing for the details of all tracing options known by this simulator.\n"
- " --version to get SimGrid version information.\n"
- "\n"
- );
- shall_exit = 1;
- } else if (not strcmp(argv[i], "--help-aliases")) {
- printf("Here is a list of all deprecated option names, with their replacement.\n");
- xbt_cfg_aliases();
- printf("Please consider using the recent names\n");
- shall_exit = 1;
- } else if (not strcmp(argv[i], "--help-models")) {
+ } else if (parse_args && not strcmp(argv[i], "--version")) {
+ sg_version();
+ shall_exit = true;
+ } else if (parse_args && (not strcmp(argv[i], "--cfg-help") || not strcmp(argv[i], "--help"))) {
+ XBT_HELP("Description of the configuration accepted by this simulator:");
+ simgrid::config::help();
+ XBT_HELP("\n"
+ "Each of these configurations can be used by adding\n"
+ " --cfg=<option name>:<option value>\n"
+ "to the command line. Try passing \"help\" as a value\n"
+ "to get the list of values accepted by a given option.\n"
+ "For example, \"--cfg=plugin:help\" gives you the list of\n"
+ "plugins available in your installation of SimGrid.\n"
+ "\n"
+ "For more information, please refer to:\n"
+ " --help-aliases for the list of all option aliases.\n"
+ " --help-logs and --help-log-categories for the details of logging output.\n"
+ " --help-models for a list of all models known by this simulator.\n"
+ " --help-tracing for the details of all tracing options known by this simulator.\n"
+ " --version to get SimGrid version information.\n");
+ shall_exit = not cfg_continue_after_help;
+ argv[j++] = argv[i]; // Preserve the --help in argv just in case someone else wants to see it
+ } else if (parse_args && not strcmp(argv[i], "--help-aliases")) {
+ XBT_HELP("Here is a list of all deprecated option names, with their replacement.");
+ simgrid::config::show_aliases();
+ XBT_HELP("Please consider using the recent names");
+ shall_exit = true;
+ } else if (parse_args && not strcmp(argv[i], "--help-models")) {