1.19 <GOptionGroup>

Structure: <GOptionGroup>

A <GOptionGroup> struct defines the options in a single group. The struct has only private fields and should not be directly accessed.

All options in a group share the same translation function. Libraries which need to parse commandline options are expected to provide a function for getting a <GOptionGroup> holding their options, which the application can then add to its GOptionContext.

Procedures

Method: option-group:free self
Method: free self

Frees a <GOptionGroup>. Note that you must not free groups which have been added to a GOptionContext.

self

Passed: a <GOptionGroup>.

a <GOptionGroup>

Procedure: option-group:new name description help-description [user-data] [destroy] ⇒ %return

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:’.

name

Passed: a string.

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

description

Passed: a string.

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

help-description

Passed: a string.

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

user-data

Passed, or left out: a foreign pointer, or a bytevector, or #f.

user data that will be passed to the pre- and post-parse hooks, the error hook and to callbacks of callback options, or #f

destroy

Passed, or left out: a procedure, or #f.

a function that will be called to free user-data, or #f

See GDestroyNotify for how it is called.

%return

Returned: a <GOptionGroup>.

a newly created option group. It should be added to a GOptionContext or freed with option-group:unref.

Method: option-group:ref self ⇒ %return
Method: ref self ⇒ %return

Increments the reference count of self by one.

self

Passed: a <GOptionGroup>.

a <GOptionGroup>

%return

Returned: a <GOptionGroup>.

a <GOptionGroup>

Method: option-group:set-translate-func self [func]
Method: set-translate-func self [func]

Sets the function which is used to translate user-visible strings, for --help output. Different groups can use different GTranslateFuncs. If func is #f, strings are not translated.

If you are using gettext(), you only need to set the translation domain, see option-group:set-translation-domain.

self

Passed: a <GOptionGroup>.

a <GOptionGroup>

func

Passed, or left out: a procedure, or #f.

the GTranslateFunc, or #f

See GTranslateFunc for how it is called.

data

Not passed: guile-gi supplies it.

user data to pass to func, or #f

destroy-notify

Not passed: guile-gi supplies it.

a function which gets called to free data, or #f

See GDestroyNotify for how it is called.

Method: option-group:set-translation-domain self domain
Method: set-translation-domain self domain

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

self

Passed: a <GOptionGroup>.

a <GOptionGroup>

domain

Passed: a string.

the domain to use

Method: option-group:unref self
Method: unref self

Decrements the reference count of self by one. If the reference count drops to 0, the self will be freed. and all memory allocated by the self is released.

self

Passed: a <GOptionGroup>.

a <GOptionGroup>