summaryrefslogtreecommitdiff
path: root/argv.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-07 13:03:42 -0600
committerJeff Carr <[email protected]>2024-11-07 13:03:42 -0600
commit1b7db666f166ce375a377858404d9108a81e0e76 (patch)
treea63a5821c452e3ff2ef928a4084e5c427045b6a4 /argv.go
parentd6f9401f6153abeb5b5ab1df61355569fc9d5a71 (diff)
update argv code
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'argv.go')
-rw-r--r--argv.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/argv.go b/argv.go
new file mode 100644
index 0000000..4183d11
--- /dev/null
+++ b/argv.go
@@ -0,0 +1,39 @@
+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 helloworld example demonstrates the 'gui' plugin toolkits
+`
+}
+
+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 "helloworld " + VERSION
+}