Gio.Application.prototype.add_option_group

function add_option_group(group: GLib.OptionGroup): void {
    // Gjs wrapper for g_application_add_option_group()
}
  

Adds a GLib.OptionGroup to the commandline handling of application.

This function is comparable to GLib.OptionContext.prototype.add_group.

Unlike Gio.Application.prototype.add_main_option_entries, this function does not deal with null @arg_data and never transmits options to the primary instance.

The reason for that is because, by the time the options arrive at the primary instance, it is typically too late to do anything with them. Taking the GTK option group as an example: GTK will already have been initialised by the time the Gio.Application::command-line handler runs. In the case that this is not the first-running instance of the application, the existing instance may already have been running for a very long time.

This means that the options from GLib.OptionGroup are only really usable in the case that the instance of the application being run is the first instance. Passing options like `--display=` or `--gdk-debug=` on future runs will have no effect on the existing primary instance.

Calling this function will cause the options in the supplied option group to be parsed, but it does not cause you to be "opted in" to the new functionality whereby unrecognised options are rejected even if Gio.ApplicationFlags.handles_command_line was given.

Since 2.40