summaryrefslogtreecommitdiff
path: root/argv.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-07 13:18:26 -0600
committerJeff Carr <[email protected]>2024-11-07 13:18:26 -0600
commit3203dfbb0ed5bffa9629e3755a562a40874d57ca (patch)
treefbb7660c18b09b7eddb592a17b75eb8269acae9c /argv.go
parent3be66547650097174b3e8aaf533cbee187f6bde9 (diff)
add standard argvv0.21.1
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'argv.go')
-rw-r--r--argv.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/argv.go b/argv.go
new file mode 100644
index 0000000..44b5b55
--- /dev/null
+++ b/argv.go
@@ -0,0 +1,38 @@
+package main
+
+import (
+ "os"
+
+ "github.com/alexflint/go-arg"
+)
+
+/*
+ this parses the command line arguements
+ this enables command line options from other packages like 'gui' and 'log'
+*/
+
+var argv args
+
+type args struct {
+ Demo string `arg:"positional" help:"this is just a demo"`
+}
+
+func (a args) Description() string {
+ return `
+This basicwindow example demonstrates multiple windows
+`
+}
+
+func init() {
+ 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 == "?" {
+ pp.WriteHelp(os.Stdout)
+ os.Exit(0)
+ }
+}
+
+func (args) Version() string {
+ return "basicwindow " + VERSION
+}