summaryrefslogtreecommitdiff
path: root/gui.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-09 00:09:48 -0500
committerJeff Carr <[email protected]>2025-09-09 00:09:48 -0500
commit2da467be82a831572422e35f248ecb7fd0955773 (patch)
treeefb258d6451b978f51b70fa152167e7aabd715fa /gui.go
day1
Diffstat (limited to 'gui.go')
-rw-r--r--gui.go59
1 files changed, 59 insertions, 0 deletions
diff --git a/gui.go b/gui.go
new file mode 100644
index 0000000..ca93a02
--- /dev/null
+++ b/gui.go
@@ -0,0 +1,59 @@
+package init
+
+// 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)
+}