### Function

# GLib OptionContext new

since: 2.6

#### Declaration

    GOptionContext*
    g_option_context_new (
      const gchar* parameter_string
    )

#### Description

Creates a new option context.

The `parameter_string` can serve multiple purposes. It can be used to add descriptions for “rest” arguments, which are not parsed by the `GOptionContext`, typically something like “FILES” or “FILE1 FILE2…”. If you are using `G_OPTION_REMAINING` for collecting “rest” arguments, GLib handles this automatically by using the `arg_description` of the corresponding `GOptionEntry` in the usage summary.

Another usage is to give a short summary of the program functionality, like ” - frob the strings”, which will be displayed in the same line as the usage. For a longer description of the program functionality that should be displayed as a paragraph below the usage line, use g_option_context_set_summary().

Note that the `parameter_string` is translated using the function set with g_option_context_set_translate_func(), so it should normally be passed untranslated.

Available since: 2.6

This function is not directly available to language bindings.

#### Parameters

`parameter_string`

  Type: `const gchar*`

  A string which is displayed in the first line of `--help` output, after the usage summary `programname [OPTION...]`.

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

#### Return value

Type: `GOptionContext`

A newly created `GOptionContext`, which must be freed with `g_option_context_free()` after use.

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