summaryrefslogtreecommitdiff
path: root/args.go
blob: 52810df425b6ffe93c75b957c98dd64fdcae7921 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package gui

import (
	arg "github.com/alexflint/go-arg"

	newlog "go.wit.com/log"
)

var argGui ArgsGui

// This struct can be used with the go-arg package
type ArgsGui struct {
	GuiDebug bool `arg:"--gui-debug" help:"open the GUI debugger"`
	GuiPlugin string `arg:"--gui" help:"Use this gui toolkit [andlabs,gocui,nocui]"`
	GuiVerbose bool `arg:"--gui-verbose" help:"enable all logging"`
}

func init() {
	arg.Register(&argGui)

	newlog.Register("gui", "debugGui", &debugGui)

	for _, s := range newlog.ListFlags() {
		newlog.Info("go.wit.org/gui ListFlags() returned:", s)
	}
}

// returns the toolkit
func ArgToolkit() string {
	return argGui.GuiPlugin
}

// returns true if --gui-debug was passed from the command line
func ArgDebug() bool {
	return argGui.GuiDebug
}