v0.2.2 9100209

goption.go RawHistoryFolder

1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/gobject/types"
12)
13
14// The type of function to be passed as callback for %G_OPTION_ARG_CALLBACK
15// options.
16type OptionArgFunc func(string, string, uintptr, **Error) bool
17
18// The type of function to be used as callback when a parse error occurs.
19type OptionErrorFunc func(*OptionContext, *OptionGroup, uintptr, **Error)
20
21// The type of function that can be called before and after parsing.
22type OptionParseFunc func(*OptionContext, *OptionGroup, uintptr, **Error) bool
23
24// A `GOptionContext` struct defines which options
25// are accepted by the commandline option parser. The struct has only private
26// fields and should not be directly accessed.
27type OptionContext struct {
28	_ structs.HostLayout
29}
30
31func (x *OptionContext) GoPointer() uintptr {
32	return uintptr(unsafe.Pointer(x))
33}
34
35var xOptionContextAddGroup func(uintptr, *OptionGroup)
36
37// Adds a #GOptionGroup to the @context, so that parsing with @context
38// will recognize the options in the group. Note that this will take
39// ownership of the @group and thus the @group should not be freed.
40func (x *OptionContext) AddGroup(GroupVar *OptionGroup) {
41
42	xOptionContextAddGroup(x.GoPointer(), GroupVar)
43
44}
45
46var xOptionContextAddMainEntries func(uintptr, []OptionEntry, uintptr)
47
48// A convenience function which creates a main group if it doesn't
49// exist, adds the @entries to it and sets the translation domain.
50func (x *OptionContext) AddMainEntries(EntriesVar []OptionEntry, TranslationDomainVar *string) {
51
52	TranslationDomainVarPtr := core.GStrdupNullable(TranslationDomainVar)
53	defer core.GFreeNullable(TranslationDomainVarPtr)
54
55	xOptionContextAddMainEntries(x.GoPointer(), EntriesVar, TranslationDomainVarPtr)
56
57}
58
59var xOptionContextFree func(uintptr)
60
61// Frees context and all the groups which have been
62// added to it.
63//
64// Please note that parsed arguments need to be freed separately (see
65// #GOptionEntry).
66func (x *OptionContext) Free() {
67
68	xOptionContextFree(x.GoPointer())
69
70}
71
72var xOptionContextGetDescription func(uintptr) string
73
74// Returns the description. See g_option_context_set_description().
75func (x *OptionContext) GetDescription() string {
76
77	cret := xOptionContextGetDescription(x.GoPointer())
78	return cret
79}
80
81var xOptionContextGetHelp func(uintptr, bool, *OptionGroup) string
82
83// Returns a formatted, translated help text for the given context.
84// To obtain the text produced by `--help`, call
85// `g_option_context_get_help (context, TRUE, NULL)`.
86// To obtain the text produced by `--help-all`, call
87// `g_option_context_get_help (context, FALSE, NULL)`.
88// To obtain the help text for an option group, call
89// `g_option_context_get_help (context, FALSE, group)`.
90func (x *OptionContext) GetHelp(MainHelpVar bool, GroupVar *OptionGroup) string {
91
92	cret := xOptionContextGetHelp(x.GoPointer(), MainHelpVar, GroupVar)
93	return cret
94}
95
96var xOptionContextGetHelpEnabled func(uintptr) bool
97
98// Returns whether automatic `--help` generation
99// is turned on for @context. See g_option_context_set_help_enabled().
100func (x *OptionContext) GetHelpEnabled() bool {
101
102	cret := xOptionContextGetHelpEnabled(x.GoPointer())
103	return cret
104}
105
106var xOptionContextGetIgnoreUnknownOptions func(uintptr) bool
107
108// Returns whether unknown options are ignored or not. See
109// g_option_context_set_ignore_unknown_options().
110func (x *OptionContext) GetIgnoreUnknownOptions() bool {
111
112	cret := xOptionContextGetIgnoreUnknownOptions(x.GoPointer())
113	return cret
114}
115
116var xOptionContextGetMainGroup func(uintptr) *OptionGroup
117
118// Returns a pointer to the main group of @context.
119func (x *OptionContext) GetMainGroup() *OptionGroup {
120
121	cret := xOptionContextGetMainGroup(x.GoPointer())
122	return cret
123}
124
125var xOptionContextGetStrictPosix func(uintptr) bool
126
127// Returns whether strict POSIX code is enabled.
128//
129// See g_option_context_set_strict_posix() for more information.
130func (x *OptionContext) GetStrictPosix() bool {
131
132	cret := xOptionContextGetStrictPosix(x.GoPointer())
133	return cret
134}
135
136var xOptionContextGetSummary func(uintptr) string
137
138// Returns the summary. See g_option_context_set_summary().
139func (x *OptionContext) GetSummary() string {
140
141	cret := xOptionContextGetSummary(x.GoPointer())
142	return cret
143}
144
145var xOptionContextParse func(uintptr, *int, *[]string, **Error) bool
146
147// Parses the command line arguments, recognizing options
148// which have been added to @context. A side-effect of
149// calling this function is that g_set_prgname() will be
150// called.
151//
152// If the parsing is successful, any parsed arguments are
153// removed from the array and @argc and @argv are updated
154// accordingly. A '--' option is stripped from @argv
155// unless there are unparsed options before and after it,
156// or some of the options after it start with '-'. In case
157// of an error, @argc and @argv are left unmodified.
158//
159// If automatic `--help` support is enabled
160// (see g_option_context_set_help_enabled()), and the
161// @argv array contains one of the recognized help options,
162// this function will produce help output to stdout and
163// call `exit (0)`.
164//
165// Note that function depends on the
166// [current locale](running.html#locale) for automatic
167// character set conversion of string and filename arguments.
168func (x *OptionContext) Parse(ArgcVar *int, ArgvVar *[]string) (bool, error) {
169	var cerr *Error
170
171	cret := xOptionContextParse(x.GoPointer(), ArgcVar, ArgvVar, &cerr)
172	if cerr == nil {
173		return cret, nil
174	}
175	return cret, cerr
176
177}
178
179var xOptionContextParseStrv func(uintptr, *[]string, **Error) bool
180
181// Parses the command line arguments.
182//
183// This function is similar to g_option_context_parse() except that it
184// respects the normal memory rules when dealing with a strv instead of
185// assuming that the passed-in array is the argv of the main function.
186//
187// In particular, strings that are removed from the arguments list will
188// be freed using g_free().
189//
190// On Windows, the strings are expected to be in UTF-8.  This is in
191// contrast to g_option_context_parse() which expects them to be in the
192// system codepage, which is how they are passed as @argv to main().
193// See g_win32_get_command_line() for a solution.
194//
195// This function is useful if you are trying to use #GOptionContext with
196// #GApplication.
197func (x *OptionContext) ParseStrv(ArgumentsVar *[]string) (bool, error) {
198	var cerr *Error
199
200	cret := xOptionContextParseStrv(x.GoPointer(), ArgumentsVar, &cerr)
201	if cerr == nil {
202		return cret, nil
203	}
204	return cret, cerr
205
206}
207
208var xOptionContextSetDescription func(uintptr, uintptr)
209
210// Adds a string to be displayed in `--help` output after the list
211// of options. This text often includes a bug reporting address.
212//
213// Note that the summary is translated (see
214// g_option_context_set_translate_func()).
215func (x *OptionContext) SetDescription(DescriptionVar *string) {
216
217	DescriptionVarPtr := core.GStrdupNullable(DescriptionVar)
218	defer core.GFreeNullable(DescriptionVarPtr)
219
220	xOptionContextSetDescription(x.GoPointer(), DescriptionVarPtr)
221
222}
223
224var xOptionContextSetHelpEnabled func(uintptr, bool)
225
226// Enables or disables automatic generation of `--help` output.
227// By default, g_option_context_parse() recognizes `--help`, `-h`,
228// `-?`, `--help-all` and `--help-groupname` and creates suitable
229// output to stdout.
230func (x *OptionContext) SetHelpEnabled(HelpEnabledVar bool) {
231
232	xOptionContextSetHelpEnabled(x.GoPointer(), HelpEnabledVar)
233
234}
235
236var xOptionContextSetIgnoreUnknownOptions func(uintptr, bool)
237
238// Sets whether to ignore unknown options or not. If an argument is
239// ignored, it is left in the @argv array after parsing. By default,
240// g_option_context_parse() treats unknown options as error.
241//
242// This setting does not affect non-option arguments (i.e. arguments
243// which don't start with a dash). But note that GOption cannot reliably
244// determine whether a non-option belongs to a preceding unknown option.
245func (x *OptionContext) SetIgnoreUnknownOptions(IgnoreUnknownVar bool) {
246
247	xOptionContextSetIgnoreUnknownOptions(x.GoPointer(), IgnoreUnknownVar)
248
249}
250
251var xOptionContextSetMainGroup func(uintptr, *OptionGroup)
252
253// Sets a #GOptionGroup as main group of the @context.
254// This has the same effect as calling g_option_context_add_group(),
255// the only difference is that the options in the main group are
256// treated differently when generating `--help` output.
257func (x *OptionContext) SetMainGroup(GroupVar *OptionGroup) {
258
259	xOptionContextSetMainGroup(x.GoPointer(), GroupVar)
260
261}
262
263var xOptionContextSetStrictPosix func(uintptr, bool)
264
265// Sets strict POSIX mode.
266//
267// By default, this mode is disabled.
268//
269// In strict POSIX mode, the first non-argument parameter encountered
270// (eg: filename) terminates argument processing.  Remaining arguments
271// are treated as non-options and are not attempted to be parsed.
272//
273// If strict POSIX mode is disabled then parsing is done in the GNU way
274// where option arguments can be freely mixed with non-options.
275//
276// As an example, consider "ls foo -l".  With GNU style parsing, this
277// will list "foo" in long mode.  In strict POSIX style, this will list
278// the files named "foo" and "-l".
279//
280// It may be useful to force strict POSIX mode when creating "verb
281// style" command line tools.  For example, the "gsettings" command line
282// tool supports the global option "--schemadir" as well as many
283// subcommands ("get", "set", etc.) which each have their own set of
284// arguments.  Using strict POSIX mode will allow parsing the global
285// options up to the verb name while leaving the remaining options to be
286// parsed by the relevant subcommand (which can be determined by
287// examining the verb name, which should be present in argv[1] after
288// parsing).
289func (x *OptionContext) SetStrictPosix(StrictPosixVar bool) {
290
291	xOptionContextSetStrictPosix(x.GoPointer(), StrictPosixVar)
292
293}
294
295var xOptionContextSetSummary func(uintptr, uintptr)
296
297// Adds a string to be displayed in `--help` output before the list
298// of options. This is typically a summary of the program functionality.
299//
300// Note that the summary is translated (see
301// g_option_context_set_translate_func() and
302// g_option_context_set_translation_domain()).
303func (x *OptionContext) SetSummary(SummaryVar *string) {
304
305	SummaryVarPtr := core.GStrdupNullable(SummaryVar)
306	defer core.GFreeNullable(SummaryVarPtr)
307
308	xOptionContextSetSummary(x.GoPointer(), SummaryVarPtr)
309
310}
311
312var xOptionContextSetTranslateFunc func(uintptr, uintptr, uintptr, uintptr)
313
314// Sets the function which is used to translate the contexts
315// user-visible strings, for `--help` output. If @func is %NULL,
316// strings are not translated.
317//
318// Note that option groups have their own translation functions,
319// this function only affects the @parameter_string (see g_option_context_new()),
320// the summary (see g_option_context_set_summary()) and the description
321// (see g_option_context_set_description()).
322//
323// If you are using gettext(), you only need to set the translation
324// domain, see g_option_context_set_translation_domain().
325func (x *OptionContext) SetTranslateFunc(FuncVar *TranslateFunc, DataVar uintptr, DestroyNotifyVar *DestroyNotify) {
326
327	var FuncVarRef uintptr
328	if FuncVar != nil {
329		FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
330		if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
331			FuncVarRef = cbRefPtr
332		} else {
333			fcb := func(arg0 uintptr, arg1 uintptr) string {
334				cbFn := *FuncVar
335				return cbFn(core.GoString(arg0), arg1)
336			}
337			FuncVarRef = purego.NewCallback(fcb)
338			SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
339		}
340	}
341
342	var DestroyNotifyVarRef uintptr
343	if DestroyNotifyVar != nil {
344		DestroyNotifyVarPtr := uintptr(unsafe.Pointer(DestroyNotifyVar))
345		if cbRefPtr, ok := GetCallback(DestroyNotifyVarPtr); ok {
346			DestroyNotifyVarRef = cbRefPtr
347		} else {
348			fcb := func(arg0 uintptr) {
349				cbFn := *DestroyNotifyVar
350				cbFn(arg0)
351			}
352			DestroyNotifyVarRef = purego.NewCallback(fcb)
353			SaveCallbackWithClosure(DestroyNotifyVarPtr, DestroyNotifyVarRef, DestroyNotifyVar)
354		}
355	}
356
357	xOptionContextSetTranslateFunc(x.GoPointer(), FuncVarRef, DataVar, DestroyNotifyVarRef)
358
359}
360
361var xOptionContextSetTranslationDomain func(uintptr, string)
362
363// A convenience function to use gettext() for translating
364// user-visible strings.
365func (x *OptionContext) SetTranslationDomain(DomainVar string) {
366
367	xOptionContextSetTranslationDomain(x.GoPointer(), DomainVar)
368
369}
370
371// - %G_OPTION_ARG_NONE: %gboolean
372//
373//   - %G_OPTION_ARG_STRING: %gchar*
374//
375//   - %G_OPTION_ARG_INT: %gint
376//
377//   - %G_OPTION_ARG_FILENAME: %gchar*
378//
379//   - %G_OPTION_ARG_STRING_ARRAY: %gchar**
380//
381//   - %G_OPTION_ARG_FILENAME_ARRAY: %gchar**
382//
383//   - %G_OPTION_ARG_DOUBLE: %gdouble
384//
385//     If @arg type is %G_OPTION_ARG_STRING or %G_OPTION_ARG_FILENAME,
386//     the location will contain a newly allocated string if the option
387//     was given. That string needs to be freed by the callee using g_free().
388//     Likewise if @arg type is %G_OPTION_ARG_STRING_ARRAY or
389//     %G_OPTION_ARG_FILENAME_ARRAY, the data should be freed using g_strfreev().
390//
391// A GOptionEntry struct defines a single option. To have an effect, they
392// must be added to a #GOptionGroup with g_option_context_add_main_entries()
393// or g_option_group_add_entries().
394type OptionEntry struct {
395	_ structs.HostLayout
396
397	LongName uintptr
398
399	ShortName byte
400
401	Flags int32
402
403	Arg OptionArg
404
405	ArgData uintptr
406
407	Description uintptr
408
409	ArgDescription uintptr
410}
411
412func (x *OptionEntry) GoPointer() uintptr {
413	return uintptr(unsafe.Pointer(x))
414}
415
416// A `GOptionGroup` struct defines the options in a single
417// group. The struct has only private fields and should not be directly accessed.
418//
419// All options in a group share the same translation function. Libraries which
420// need to parse commandline options are expected to provide a function for
421// getting a `GOptionGroup` holding their options, which
422// the application can then add to its #GOptionContext.
423type OptionGroup struct {
424	_ structs.HostLayout
425}
426
427var xOptionGroupGLibType func() types.GType
428
429func OptionGroupGLibType() types.GType {
430	return xOptionGroupGLibType()
431}
432
433func (x *OptionGroup) GoPointer() uintptr {
434	return uintptr(unsafe.Pointer(x))
435}
436
437var xNewOptionGroup func(string, string, string, uintptr, uintptr) *OptionGroup
438
439// Creates a new #GOptionGroup.
440//
441// @description is typically used to provide a title for the group. If so, it
442// is recommended that it’s written in title case, and has a trailing colon so
443// that it matches the style of built-in GLib group titles such as
444// ‘Application Options:’.
445func NewOptionGroup(NameVar string, DescriptionVar string, HelpDescriptionVar string, UserDataVar uintptr, DestroyVar *DestroyNotify) *OptionGroup {
446
447	var DestroyVarRef uintptr
448	if DestroyVar != nil {
449		DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar))
450		if cbRefPtr, ok := GetCallback(DestroyVarPtr); ok {
451			DestroyVarRef = cbRefPtr
452		} else {
453			fcb := func(arg0 uintptr) {
454				cbFn := *DestroyVar
455				cbFn(arg0)
456			}
457			DestroyVarRef = purego.NewCallback(fcb)
458			SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar)
459		}
460	}
461
462	cret := xNewOptionGroup(NameVar, DescriptionVar, HelpDescriptionVar, UserDataVar, DestroyVarRef)
463	return cret
464}
465
466var xOptionGroupAddEntries func(uintptr, []OptionEntry)
467
468// Adds the options specified in @entries to @group.
469func (x *OptionGroup) AddEntries(EntriesVar []OptionEntry) {
470
471	xOptionGroupAddEntries(x.GoPointer(), EntriesVar)
472
473}
474
475var xOptionGroupFree func(uintptr)
476
477// Frees a #GOptionGroup. Note that you must not free groups
478// which have been added to a #GOptionContext.
479func (x *OptionGroup) Free() {
480
481	xOptionGroupFree(x.GoPointer())
482
483}
484
485var xOptionGroupRef func(uintptr) *OptionGroup
486
487// Increments the reference count of @group by one.
488func (x *OptionGroup) Ref() *OptionGroup {
489
490	cret := xOptionGroupRef(x.GoPointer())
491	return cret
492}
493
494var xOptionGroupSetErrorHook func(uintptr, uintptr)
495
496// Associates a function with @group which will be called
497// from g_option_context_parse() when an error occurs.
498//
499// Note that the user data to be passed to @error_func can be
500// specified when constructing the group with g_option_group_new().
501func (x *OptionGroup) SetErrorHook(ErrorFuncVar *OptionErrorFunc) {
502
503	var ErrorFuncVarRef uintptr
504	if ErrorFuncVar != nil {
505		ErrorFuncVarPtr := uintptr(unsafe.Pointer(ErrorFuncVar))
506		if cbRefPtr, ok := GetCallback(ErrorFuncVarPtr); ok {
507			ErrorFuncVarRef = cbRefPtr
508		} else {
509			fcb := func(arg0 *OptionContext, arg1 *OptionGroup, arg2 uintptr, arg3 **Error) {
510				cbFn := *ErrorFuncVar
511				cbFn(arg0, arg1, arg2, arg3)
512			}
513			ErrorFuncVarRef = purego.NewCallback(fcb)
514			SaveCallbackWithClosure(ErrorFuncVarPtr, ErrorFuncVarRef, ErrorFuncVar)
515		}
516	}
517
518	xOptionGroupSetErrorHook(x.GoPointer(), ErrorFuncVarRef)
519
520}
521
522var xOptionGroupSetParseHooks func(uintptr, uintptr, uintptr)
523
524// Associates two functions with @group which will be called
525// from g_option_context_parse() before the first option is parsed
526// and after the last option has been parsed, respectively.
527//
528// Note that the user data to be passed to @pre_parse_func and
529// @post_parse_func can be specified when constructing the group
530// with g_option_group_new().
531func (x *OptionGroup) SetParseHooks(PreParseFuncVar *OptionParseFunc, PostParseFuncVar *OptionParseFunc) {
532
533	var PreParseFuncVarRef uintptr
534	if PreParseFuncVar != nil {
535		PreParseFuncVarPtr := uintptr(unsafe.Pointer(PreParseFuncVar))
536		if cbRefPtr, ok := GetCallback(PreParseFuncVarPtr); ok {
537			PreParseFuncVarRef = cbRefPtr
538		} else {
539			fcb := func(arg0 *OptionContext, arg1 *OptionGroup, arg2 uintptr, arg3 **Error) bool {
540				cbFn := *PreParseFuncVar
541				return cbFn(arg0, arg1, arg2, arg3)
542			}
543			PreParseFuncVarRef = purego.NewCallback(fcb)
544			SaveCallbackWithClosure(PreParseFuncVarPtr, PreParseFuncVarRef, PreParseFuncVar)
545		}
546	}
547
548	var PostParseFuncVarRef uintptr
549	if PostParseFuncVar != nil {
550		PostParseFuncVarPtr := uintptr(unsafe.Pointer(PostParseFuncVar))
551		if cbRefPtr, ok := GetCallback(PostParseFuncVarPtr); ok {
552			PostParseFuncVarRef = cbRefPtr
553		} else {
554			fcb := func(arg0 *OptionContext, arg1 *OptionGroup, arg2 uintptr, arg3 **Error) bool {
555				cbFn := *PostParseFuncVar
556				return cbFn(arg0, arg1, arg2, arg3)
557			}
558			PostParseFuncVarRef = purego.NewCallback(fcb)
559			SaveCallbackWithClosure(PostParseFuncVarPtr, PostParseFuncVarRef, PostParseFuncVar)
560		}
561	}
562
563	xOptionGroupSetParseHooks(x.GoPointer(), PreParseFuncVarRef, PostParseFuncVarRef)
564
565}
566
567var xOptionGroupSetTranslateFunc func(uintptr, uintptr, uintptr, uintptr)
568
569// Sets the function which is used to translate user-visible strings,
570// for `--help` output. Different groups can use different
571// #GTranslateFuncs. If @func is %NULL, strings are not translated.
572//
573// If you are using gettext(), you only need to set the translation
574// domain, see g_option_group_set_translation_domain().
575func (x *OptionGroup) SetTranslateFunc(FuncVar *TranslateFunc, DataVar uintptr, DestroyNotifyVar *DestroyNotify) {
576
577	var FuncVarRef uintptr
578	if FuncVar != nil {
579		FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
580		if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
581			FuncVarRef = cbRefPtr
582		} else {
583			fcb := func(arg0 uintptr, arg1 uintptr) string {
584				cbFn := *FuncVar
585				return cbFn(core.GoString(arg0), arg1)
586			}
587			FuncVarRef = purego.NewCallback(fcb)
588			SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
589		}
590	}
591
592	var DestroyNotifyVarRef uintptr
593	if DestroyNotifyVar != nil {
594		DestroyNotifyVarPtr := uintptr(unsafe.Pointer(DestroyNotifyVar))
595		if cbRefPtr, ok := GetCallback(DestroyNotifyVarPtr); ok {
596			DestroyNotifyVarRef = cbRefPtr
597		} else {
598			fcb := func(arg0 uintptr) {
599				cbFn := *DestroyNotifyVar
600				cbFn(arg0)
601			}
602			DestroyNotifyVarRef = purego.NewCallback(fcb)
603			SaveCallbackWithClosure(DestroyNotifyVarPtr, DestroyNotifyVarRef, DestroyNotifyVar)
604		}
605	}
606
607	xOptionGroupSetTranslateFunc(x.GoPointer(), FuncVarRef, DataVar, DestroyNotifyVarRef)
608
609}
610
611var xOptionGroupSetTranslationDomain func(uintptr, string)
612
613// A convenience function to use gettext() for translating
614// user-visible strings.
615func (x *OptionGroup) SetTranslationDomain(DomainVar string) {
616
617	xOptionGroupSetTranslationDomain(x.GoPointer(), DomainVar)
618
619}
620
621var xOptionGroupUnref func(uintptr)
622
623// Decrements the reference count of @group by one.
624// If the reference count drops to 0, the @group will be freed.
625// and all memory allocated by the @group is released.
626func (x *OptionGroup) Unref() {
627
628	xOptionGroupUnref(x.GoPointer())
629
630}
631
632const (
633	// If a long option in the main group has this name, it is not treated as a
634	// regular option. Instead it collects all non-option arguments which would
635	// otherwise be left in `argv`. The option must be of type
636	// %G_OPTION_ARG_CALLBACK, %G_OPTION_ARG_STRING_ARRAY
637	// or %G_OPTION_ARG_FILENAME_ARRAY.
638	//
639	//
640	// Using %G_OPTION_REMAINING instead of simply scanning `argv`
641	// for leftover arguments has the advantage that GOption takes care of
642	// necessary encoding conversions for strings or filenames.
643	OPTION_REMAINING string = ""
644)
645
646// Flags which modify individual options.
647type OptionFlags int
648
649const (
650
651	// No flags.
652	GOptionFlagNoneValue OptionFlags = 0
653	// The option doesn't appear in `--help` output.
654	GOptionFlagHiddenValue OptionFlags = 1
655	// The option appears in the main section of the
656	//   `--help` output, even if it is defined in a group.
657	GOptionFlagInMainValue OptionFlags = 2
658	// For options of the %G_OPTION_ARG_NONE kind, this
659	//   flag indicates that the sense of the option is reversed. i.e. %FALSE will
660	//   be stored into the argument rather than %TRUE.
661	GOptionFlagReverseValue OptionFlags = 4
662	// For options of the %G_OPTION_ARG_CALLBACK kind,
663	//   this flag indicates that the callback does not take any argument
664	//   (like a %G_OPTION_ARG_NONE option). Since 2.8
665	GOptionFlagNoArgValue OptionFlags = 8
666	// For options of the %G_OPTION_ARG_CALLBACK
667	//   kind, this flag indicates that the argument should be passed to the
668	//   callback in the GLib filename encoding rather than UTF-8. Since 2.8
669	GOptionFlagFilenameValue OptionFlags = 16
670	// For options of the %G_OPTION_ARG_CALLBACK
671	//   kind, this flag indicates that the argument supply is optional.
672	//   If no argument is given then data of %GOptionParseFunc will be
673	//   set to NULL. Since 2.8
674	GOptionFlagOptionalArgValue OptionFlags = 32
675	// This flag turns off the automatic conflict
676	//   resolution which prefixes long option names with `groupname-` if
677	//   there is a conflict. This option should only be used in situations
678	//   where aliasing is necessary to model some legacy commandline interface.
679	//   It is not safe to use this option, unless all option groups are under
680	//   your direct control. Since 2.8.
681	GOptionFlagNoaliasValue OptionFlags = 64
682	// This flag marks the option as deprecated in the `--help`.
683	//
684	// You should update the description of the option to describe what
685	// the user should do in response to the deprecation, for instance:
686	// remove the option, or replace it with another one.
687	GOptionFlagDeprecatedValue OptionFlags = 128
688)
689
690// The #GOptionArg enum values determine which type of extra argument the
691// options expect to find. If an option expects an extra argument, it can
692// be specified in several ways; with a short option: `-x arg`, with a long
693// option: `--name arg` or combined in a single argument: `--name=arg`.
694type OptionArg int
695
696const (
697
698	// No extra argument. This is useful for simple flags or booleans.
699	GOptionArgNoneValue OptionArg = 0
700	// The option takes a UTF-8 string argument.
701	GOptionArgStringValue OptionArg = 1
702	// The option takes an integer argument.
703	GOptionArgIntValue OptionArg = 2
704	// The option provides a callback (of type #GOptionArgFunc)
705	//   to parse the extra argument.
706	GOptionArgCallbackValue OptionArg = 3
707	// The option takes a filename as argument, which will
708	//      be in the GLib filename encoding rather than UTF-8.
709	GOptionArgFilenameValue OptionArg = 4
710	// The option takes a string argument, multiple
711	//   uses of the option are collected into an array of strings.
712	GOptionArgStringArrayValue OptionArg = 5
713	// The option takes a filename as argument,
714	//   multiple uses of the option are collected into an array of strings.
715	GOptionArgFilenameArrayValue OptionArg = 6
716	// The option takes a double argument. The argument
717	//   can be formatted either for the user's locale or for the "C" locale.
718	//   Since 2.12
719	GOptionArgDoubleValue OptionArg = 7
720	// The option takes a 64-bit integer. Like
721	//   %G_OPTION_ARG_INT but for larger numbers. The number can be in
722	//   decimal base, or in hexadecimal (when prefixed with `0x`, for
723	//   example, `0xffffffff`). Since 2.12
724	GOptionArgInt64Value OptionArg = 8
725)
726
727// Error codes returned by option parsing.
728type OptionError int
729
730const (
731
732	// An option was not known to the parser.
733	//  This error will only be reported, if the parser hasn't been instructed
734	//  to ignore unknown options, see g_option_context_set_ignore_unknown_options().
735	GOptionErrorUnknownOptionValue OptionError = 0
736	// A value couldn't be parsed.
737	GOptionErrorBadValueValue OptionError = 1
738	// A #GOptionArgFunc callback failed.
739	GOptionErrorFailedValue OptionError = 2
740)
741
742func init() {
743	core.SetPackageName("GLIB", "glib-2.0")
744	core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
745	var libs []uintptr
746	for _, libPath := range core.GetPaths("GLIB") {
747		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
748		if err != nil {
749			panic(err)
750		}
751		libs = append(libs, lib)
752	}
753
754	core.PuregoSafeRegister(&xOptionContextAddGroup, libs, "g_option_context_add_group")
755	core.PuregoSafeRegister(&xOptionContextAddMainEntries, libs, "g_option_context_add_main_entries")
756	core.PuregoSafeRegister(&xOptionContextFree, libs, "g_option_context_free")
757	core.PuregoSafeRegister(&xOptionContextGetDescription, libs, "g_option_context_get_description")
758	core.PuregoSafeRegister(&xOptionContextGetHelp, libs, "g_option_context_get_help")
759	core.PuregoSafeRegister(&xOptionContextGetHelpEnabled, libs, "g_option_context_get_help_enabled")
760	core.PuregoSafeRegister(&xOptionContextGetIgnoreUnknownOptions, libs, "g_option_context_get_ignore_unknown_options")
761	core.PuregoSafeRegister(&xOptionContextGetMainGroup, libs, "g_option_context_get_main_group")
762	core.PuregoSafeRegister(&xOptionContextGetStrictPosix, libs, "g_option_context_get_strict_posix")
763	core.PuregoSafeRegister(&xOptionContextGetSummary, libs, "g_option_context_get_summary")
764	core.PuregoSafeRegister(&xOptionContextParse, libs, "g_option_context_parse")
765	core.PuregoSafeRegister(&xOptionContextParseStrv, libs, "g_option_context_parse_strv")
766	core.PuregoSafeRegister(&xOptionContextSetDescription, libs, "g_option_context_set_description")
767	core.PuregoSafeRegister(&xOptionContextSetHelpEnabled, libs, "g_option_context_set_help_enabled")
768	core.PuregoSafeRegister(&xOptionContextSetIgnoreUnknownOptions, libs, "g_option_context_set_ignore_unknown_options")
769	core.PuregoSafeRegister(&xOptionContextSetMainGroup, libs, "g_option_context_set_main_group")
770	core.PuregoSafeRegister(&xOptionContextSetStrictPosix, libs, "g_option_context_set_strict_posix")
771	core.PuregoSafeRegister(&xOptionContextSetSummary, libs, "g_option_context_set_summary")
772	core.PuregoSafeRegister(&xOptionContextSetTranslateFunc, libs, "g_option_context_set_translate_func")
773	core.PuregoSafeRegister(&xOptionContextSetTranslationDomain, libs, "g_option_context_set_translation_domain")
774
775	core.PuregoSafeRegister(&xOptionGroupGLibType, libs, "g_option_group_get_type")
776
777	core.PuregoSafeRegister(&xNewOptionGroup, libs, "g_option_group_new")
778
779	core.PuregoSafeRegister(&xOptionGroupAddEntries, libs, "g_option_group_add_entries")
780	core.PuregoSafeRegister(&xOptionGroupFree, libs, "g_option_group_free")
781	core.PuregoSafeRegister(&xOptionGroupRef, libs, "g_option_group_ref")
782	core.PuregoSafeRegister(&xOptionGroupSetErrorHook, libs, "g_option_group_set_error_hook")
783	core.PuregoSafeRegister(&xOptionGroupSetParseHooks, libs, "g_option_group_set_parse_hooks")
784	core.PuregoSafeRegister(&xOptionGroupSetTranslateFunc, libs, "g_option_group_set_translate_func")
785	core.PuregoSafeRegister(&xOptionGroupSetTranslationDomain, libs, "g_option_group_set_translation_domain")
786	core.PuregoSafeRegister(&xOptionGroupUnref, libs, "g_option_group_unref")
787
788}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close