summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.go28
-rw-r--r--main.go19
-rw-r--r--structs.go8
3 files changed, 30 insertions, 25 deletions
diff --git a/argv.go b/argv.go
index 59ad7ff..83e333a 100644
--- a/argv.go
+++ b/argv.go
@@ -1,5 +1,10 @@
package main
+import (
+ "go.wit.com/dev/alexflint/arg"
+ "go.wit.com/gui"
+)
+
/*
this parses the command line arguements
this enables command line options from other packages like 'gui' and 'log'
@@ -7,16 +12,31 @@ package main
var argv args
+var APPNAME string = "basicwindow"
+
+// sent via -ldflags
+var VERSION string
+var BUILDTIME string
+
+// define your command line arguements here
type args struct {
Demo string `arg:"positional" help:"this is just a demo"`
}
+func (args) InitArgv() (string, string, string) {
+ // "basicwindow", "2025/10/18", "v0.2.0"
+ return APPNAME, BUILDTIME, VERSION
+}
+
+func (args) InitGui() error {
+ // panic("got here")
+ arg.Register(&gui.ArgvGui)
+ // me.myGui = gui.New()
+ return nil
+}
+
func (a args) Description() string {
return `
This basicwindow example demonstrates multiple windows
`
}
-
-func (args) Version() string {
- return "basicwindow " + VERSION
-}
diff --git a/main.go b/main.go
index 7af7d4a..c92965e 100644
--- a/main.go
+++ b/main.go
@@ -1,18 +1,12 @@
package main
import (
- "os"
-
- "go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
- "go.wit.com/lib/gui/prep"
+ "go.wit.com/lib/protobuf/argvpb"
"go.wit.com/log"
)
-// sent via -ldflags
-var VERSION string
-
// this is the primary window. If you close it, the program will exit
var mainWindow *gui.Node
@@ -27,16 +21,7 @@ var colors *gui.Node
func main() {
me := new(mainType)
- me.myGui = prep.Gui() // prepares the GUI package for go-args
- me.pp = arg.MustParse(&argv)
-
- // for very new users or users unfamilar with the command line, this may help them
- if argv.Demo == "version" || argv.Demo == "help" || argv.Demo == "?" {
- me.pp.WriteHelp(os.Stdout)
- os.Exit(0)
- }
-
- me.myGui.Start() // loads the GUI toolkit (GO Plugins)
+ me.argv = argvpb.Autocomplete(&argv) // adds shell auto complete to go-args
helloworld()
basicWindow = makebasicWindow()
diff --git a/structs.go b/structs.go
index 6251719..a4a2c4e 100644
--- a/structs.go
+++ b/structs.go
@@ -4,14 +4,14 @@
package main
import (
- "go.wit.com/dev/alexflint/arg"
- "go.wit.com/lib/gui/prep"
+ "go.wit.com/gui"
+ "go.wit.com/lib/protobuf/argvpb"
)
var me *mainType
// this app's variables
type mainType struct {
- pp *arg.Parser // for parsing the command line args. Yay to alexf lint!
- myGui *prep.GuiPrep // the gui toolkit handle
+ argv *argvpb.Argv // shell autocomplete
+ myGui *gui.Node // the gui toolkit handle
}