summaryrefslogtreecommitdiff
path: root/argv.template.go
diff options
context:
space:
mode:
Diffstat (limited to 'argv.template.go')
-rw-r--r--argv.template.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/argv.template.go b/argv.template.go
index e27de59..5bfbdfd 100644
--- a/argv.template.go
+++ b/argv.template.go
@@ -10,10 +10,26 @@ import (
"go.wit.com/gui"
)
+// this must be global until further development and abstraction
+var argvpp *arg.Parser // the go-arg parser of the command line
+
func (args) InitArgv() (string, string, string) {
return APPNAME, BUILDTIME, VERSION
}
+// this function will send the current argv PB to go-args for parsing
+func (args) ParseFlags(flags []string) error {
+ var err error
+ if argvpp == nil {
+ // log.Info("Parse Flags GOT flags:", flags)
+ argvpp, err = arg.ParseFlags(flags, &argv)
+ // panic("got to the app's ParseFlags()")
+ } else {
+ panic("argvpp was not nil")
+ }
+ return err
+}
+
func (args) InitGui() error {
// panic("got here")
arg.Register(&gui.ArgvGui)
@@ -26,13 +42,10 @@ func (args) Help() string {
}
func (args) MustParse() error {
- me.pp = arg.MustParse(&argv)
+ argvpp = arg.MustParse(&argv)
return nil
}
-func (args) ParseFlags(flags []string, dest string) {
-}
-
/*
argv.Print.go: me.pp.WriteHelp(os.Stdout)
argv.SendStrings.go: me.pp.WriteHelpForAutocomplete(os.Stderr, os.Stdout, partial, cmd...)