### Function

# GLib OptionGroup new

since: 2.6

#### Declaration [src]

    GOptionGroup*
    g_option_group_new (
      const gchar* name,
      const gchar* description,
      const gchar* help_description,
      gpointer user_data,
      GDestroyNotify destroy
    )

#### Description [src]

Creates a new `GOptionGroup`.

`description` is typically used to provide a title for the group. If so, it is recommended that it’s written in title case, and has a trailing colon so that it matches the style of built-in GLib group titles such as ‘Application Options:’.

Available since: 2.6

#### Parameters

`name`

  Type: `const gchar*`

  The name for the option group, this is used to provide help for the options in this group with `--help-``name`.

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

`description`

  Type: `const gchar*`

  A description for this group to be shown in `--help`. This string is translated using the translation domain or translation function of the group.

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

`help_description`

  Type: `const gchar*`

  A description for the `--help-``name` option. This string is translated using the translation domain or translation function of the group.

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

`user_data`

  Type: `gpointer`

  User data that will be passed to the pre- and post-parse hooks, the error hook and to callbacks of `G_OPTION_ARG_CALLBACK` options, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`destroy`

  Type: `GDestroyNotify`

  A function that will be called to free `user_data`, or `NULL`.

#### Return value

Type: `GOptionGroup`

A newly created option group. It should be added to a `GOptionContext` or freed with g_option_group_unref().

The caller of the function takes ownership of the data, and is responsible for freeing it.