:right-sidebar: True OptionEntry =================================================================== .. currentmodule:: gi.repository.GLib .. class:: OptionEntry(*args, **kwargs) :no-contents-entry: A GOptionEntry struct defines a single option. To have an effect, they must be added to a :obj:`~gi.repository.GLib.OptionGroup` with :func:`~gi.repository.GLib.OptionContext.add_main_entries` or :func:`~gi.repository.GLib.OptionGroup.add_entries`. Fields ------ .. rst-class:: interim-class .. class:: OptionEntry :no-index: .. attribute:: arg The type of the option, as a :obj:`~gi.repository.GLib.OptionArg` .. attribute:: arg_data If the ``arg`` type is :const:`~gi.repository.GLib.OptionArg.CALLBACK`, then ``arg_data`` must point to a ``GOptionArgFunc`` callback function, which will be called to handle the extra argument. Otherwise, ``arg_data`` is a pointer to a location to store the value, the required type of the location depends on the ``arg`` type: - :const:`~gi.repository.GLib.OptionArg.NONE`: :obj:`bool` - :const:`~gi.repository.GLib.OptionArg.STRING`: :obj:`str` - :const:`~gi.repository.GLib.OptionArg.INT`: :obj:`int` - :const:`~gi.repository.GLib.OptionArg.FILENAME`: :obj:`str` - :const:`~gi.repository.GLib.OptionArg.STRING_ARRAY`: :obj:`list[str]` - :const:`~gi.repository.GLib.OptionArg.FILENAME_ARRAY`: :obj:`list[str]` - :const:`~gi.repository.GLib.OptionArg.DOUBLE`: :obj:`float` If ``arg`` type is :const:`~gi.repository.GLib.OptionArg.STRING` or :const:`~gi.repository.GLib.OptionArg.FILENAME`, the location will contain a newly allocated string if the option was given. That string needs to be freed by the callee using :func:`~gi.repository.GLib.free`. Likewise if ``arg`` type is :const:`~gi.repository.GLib.OptionArg.STRING_ARRAY` or :const:`~gi.repository.GLib.OptionArg.FILENAME_ARRAY`, the data should be freed using :func:`~gi.repository.GLib.strfreev`. .. attribute:: arg_description The placeholder to use for the extra argument parsed by the option in ``--help`` output. The ``arg_description`` is translated using the ``translate_func`` of the group, see :func:`~gi.repository.GLib.OptionGroup.set_translation_domain`. .. attribute:: description The description for the option in ``--help`` output. The ``description`` is translated using the ``translate_func`` of the group, see :func:`~gi.repository.GLib.OptionGroup.set_translation_domain`. .. attribute:: flags Flags from ``GOptionFlags`` .. attribute:: long_name The long name of an option can be used to specify it in a commandline as ``--long_name``\. Every option must have a long name. To resolve conflicts if multiple option groups contain the same long name, it is also possible to specify the option as ``--groupname-long_name``\. .. attribute:: short_name If an option has a short name, it can be specified ``-short_name`` in a commandline. ``short_name`` must be a printable ASCII character different from '-', or zero if the option has no short name.