OptionContext

class OptionContext(pointer: <Error class: unknown class><<Error class: unknown class>>) : ProxyInstance

A GOptionContext struct defines which options are accepted by the commandline option parser. The struct has only private fields and should not be directly accessed.

Skipped during bindings generation

  • parameter entries: OptionEntry

  • method parse: In/Out parameter is not supported

  • method parse_strv: In/Out parameter is not supported

  • function new: Return type OptionContext is unsupported

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Properties

Link copied to clipboard
val glibOptionContextPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val handle: <Error class: unknown class>?

Functions

Link copied to clipboard
fun addGroup(group: OptionGroup)

Adds a #GOptionGroup to the @context, so that parsing with @context will recognize the options in the group. Note that this will take ownership of the @group and thus the @group should not be freed.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compare two proxy instances for equality. This will compare both the type of the instances, and their memory addresses.

Link copied to clipboard
fun free()

Frees context and all the groups which have been added to it.

Link copied to clipboard

Returns the description. See g_option_context_set_description().

Link copied to clipboard
fun getHelp(mainHelp: Boolean, group: OptionGroup? = null): String

Returns a formatted, translated help text for the given context. To obtain the text produced by --help, call g_option_context_get_help (context, TRUE, NULL). To obtain the text produced by --help-all, call g_option_context_get_help (context, FALSE, NULL). To obtain the help text for an option group, call g_option_context_get_help (context, FALSE, group).

Link copied to clipboard

Returns whether automatic --help generation is turned on for @context. See g_option_context_set_help_enabled().

Link copied to clipboard

Returns whether unknown options are ignored or not. See g_option_context_set_ignore_unknown_options().

Link copied to clipboard

Returns a pointer to the main group of @context.

Link copied to clipboard

Returns whether strict POSIX code is enabled.

Link copied to clipboard

Returns the summary. See g_option_context_set_summary().

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun setDescription(description: String? = null)

Adds a string to be displayed in --help output after the list of options. This text often includes a bug reporting address.

Link copied to clipboard
fun setHelpEnabled(helpEnabled: Boolean)

Enables or disables automatic generation of --help output. By default, g_option_context_parse() recognizes --help, -h, -?, --help-all and --help-groupname and creates suitable output to stdout.

Link copied to clipboard
fun setIgnoreUnknownOptions(ignoreUnknown: Boolean)

Sets whether to ignore unknown options or not. If an argument is ignored, it is left in the @argv array after parsing. By default, g_option_context_parse() treats unknown options as error.

Link copied to clipboard

Sets a #GOptionGroup as main group of the @context. This has the same effect as calling g_option_context_add_group(), the only difference is that the options in the main group are treated differently when generating --help output.

Link copied to clipboard
fun setStrictPosix(strictPosix: Boolean)

Sets strict POSIX mode.

Link copied to clipboard
fun setSummary(summary: String? = null)

Adds a string to be displayed in --help output before the list of options. This is typically a summary of the program functionality.

Link copied to clipboard

Sets the function which is used to translate the contexts user-visible strings, for --help output. If @func is null, strings are not translated.

Link copied to clipboard

A convenience function to use gettext() for translating user-visible strings.