Package: glib

Function g-option-context-add-main-entries

Lambda List

g-option-context-add-main-entries (context entries domain)

Arguments

context -- a g-option-context instance
entries -- a list of option entries
domain -- a string with a translation domain to use for translating the --help output for the options in entries with GNU gettext, or nil

Details

A convenience function which creates a main group if it does not exist, adds the option entries to it and sets the translation domain.

The list of option entries has the following syntax. See the g-option-context documentation for a complete example.
(let ((entries '((long-name
                  short-name
                  flags
                  arg
                  arg-data
                  description
                  arg-description)
                 (<next option>)
                 )))
   ...)  
long-name
A string with the long name of an option can be used to specify it in a command line 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.
short-name
If an option has a short name, it can be specified -short-name in a command line. The argument short-name must be a printable ASCII character different from '-', or #Nul if the option has no short name.
flags
Flags from the g-option-flags bitfield.
arg
The type of the option, as a g-option-arg value.
arg-data
If the arg type is :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. If the arg type is :string or :filename the location will contain a newly allocated string if the option was given.
description
A string with the description for the option in --help output. The description is translated using the translate-func callback function of the group, see the g-option-group-set-translation-domain function.
arg-description
A string with the placeholder to use for the extra argument parsed by the option in --help output. The arg-description argument is translated using the translate-func callback function of the group, see the g-option-group-set-translation-domain function.
 

See also

2021-9-3