Gio.Application.add_main_option

### Method

# Gio Applicationadd_main_option

since: 2.42

#### Declaration [src]

    void
    g_application_add_main_option (
      GApplication* application,
      const char* long_name,
      char short_name,
      GOptionFlags flags,
      GOptionArg arg,
      const char* description,
      const char* arg_description
    )

#### Description [src]

Add an option to be handled by `application`.

Calling this function is the equivalent of calling `g_application_add_main_option_entries()` with a single `GOptionEntry` that has its arg_data member set to `NULL`.

The parsed arguments will be packed into a `GVariantDict` which is passed to `GApplication::handle-local-options`. If `G_APPLICATION_HANDLES_COMMAND_LINE` is set, then it will also be sent to the primary instance. See `g_application_add_main_option_entries()` for more details.

See `GOptionEntry` for more documentation of the arguments.

Available since: 2.42

#### Parameters

`long_name`

  Type: `const char*`

  The long name of an option used to specify it in a commandline.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`short_name`

  Type: `char`

  The short name of an option.

`flags`

  Type: `GOptionFlags`

  Flags from `GOptionFlags`.

`arg`

  Type: `GOptionArg`

  The type of the option, as a `GOptionArg`.

`description`

  Type: `const char*`

  The description for the option in `--help` output.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`arg_description`

  Type: `const char*`

  The placeholder to use for the extra argument parsed by the option in `--help` output.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.