glib.option_context
Module for [OptionContext] class
class OptionContext
Types 1
classOptionContext
A glib.option_context.OptionContext struct defines which options are accepted by the commandline option parser. The struct has only private fields and should not be directly accessed.
Methods
void * _cPtr() nothrowvoid addGroup(glib.option_group.OptionGroup group) nothrowAdds 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.void addMainEntries(glib.types.OptionEntry[] entries, string translationDomain = null) nothrowA convenience function which creates a main group if it doesn't exist, adds the entries to it and sets the translation domain.string getDescription() nothrowReturns the description. See [glib.option_context.OptionContext.setDescription]. Returns: the descriptionstring getHelp(bool mainHelp, glib.option_group.OptionGroup group = null) nothrowReturns 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 `--h...bool getHelpEnabled() nothrowReturns whether automatic `--help` generation is turned on for context. See [glib.option_context.OptionContext.setHelpEnabled]. Returns: true if automatic help generation is turned on.bool getIgnoreUnknownOptions() nothrowReturns whether unknown options are ignored or not. See [glib.option_context.OptionContext.setIgnoreUnknownOptions]. Returns: true if unknown options are ignored.glib.option_group.OptionGroup getMainGroup() nothrowReturns a pointer to the main group of context. Returns: the main group of context, or null if context doesn't have a main group. Note that group belongs to context and should not be modified or fr...string getSummary() nothrowReturns the summary. See [glib.option_context.OptionContext.setSummary]. Returns: the summaryvoid setDescription(string description = null) nothrowAdds a string to be displayed in `--help` output after the list of options. This text often includes a bug reporting address.void setHelpEnabled(bool helpEnabled) nothrowEnables or disables automatic generation of `--help` output. By default, [glib.option_context.OptionContext.parse] recognizes `--help`, `-h`, `-?`, `--help-all` and `--help-groupname` and creates s...void setIgnoreUnknownOptions(bool ignoreUnknown) nothrowSets whether to ignore unknown options or not. If an argument is ignored, it is left in the argv array after parsing. By default, [glib.option_context.OptionContext.parse] treats unknown options as...void setMainGroup(glib.option_group.OptionGroup group) nothrowSets a #GOptionGroup as main group of the context. This has the same effect as calling [glib.option_context.OptionContext.addGroup], the only difference is that the options in the main group are tr...void setSummary(string summary = null) nothrowAdds a string to be displayed in `--help` output before the list of options. This is typically a summary of the program functionality.void setTranslateFunc(glib.types.TranslateFunc func = null) nothrowSets the function which is used to translate the contexts user-visible strings, for `--help` output. If func is null, strings are not translated.void setTranslationDomain(string domain) nothrowA convenience function to use gettext() for translating user-visible strings.Destructors