blob: 1ebf6425436e2e409860804fdc4b7240e2dfcb14 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
package prep
// initializes logging and command line options
import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
)
var argGui ArgsGui
/*
This struct can be used with the go-arg package. These
are the generic default command line arguments for the 'GUI' package
*/
type ArgsGui struct {
GuiPluginHack string `arg:"--gui-check-plugin" help:"hack to verify GO plugins load"`
}
/*
used for command line options.
This allows you to control the toolkit settings from the command line
--debugger # opens the debugger
--gui andlabs # loads the GTK toolkit on linux or Cocoa on mac
--gui gocui # runs your program in the terminal in ncurses-like mode
*/
/*
func ArgToolkit() string {
return argGui.GuiPlugin
}
func init() {
arg.Register(&argGui)
}
// this should never happen because this is before go-args MustParse()
if argGui.GuiPluginHack != "" {
// does os.Exec() and does not return
gui.TestPluginAndExit()
}
*/
// after go-args MustParse & user configuration
// the gui package can pull out the final settings and init() the GO Plugin GUI Toolkit
func postMustParse(s string) string {
switch s {
case "PluginHack":
return argGui.GuiPluginHack
default:
return ""
}
}
func Gui() *gui.Node {
arg.Register(&argDebugger)
return gui.PreInit(postMustParse)
}
|