diff options
| author | Jeff Carr <[email protected]> | 2025-10-18 06:36:48 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-18 06:36:48 -0500 | 
| commit | 0b25f021974cd96a9619dd0fc39385557926db4a (patch) | |
| tree | e556a11345815a4c3856936285f785660facc637 | |
| parent | 2ea632eac5a877567fc44cb2af9aef414de3e7dd (diff) | |
passes the flags through to the go-arg parser
| -rw-r--r-- | argv.template.go | 21 | ||||
| -rw-r--r-- | structs.go | 2 | 
2 files changed, 17 insertions, 6 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...) @@ -5,7 +5,6 @@ package main  import (  	"go.wit.com/gui" -	"go.wit.com/dev/alexflint/arg"  	"go.wit.com/lib/protobuf/argvpb"  ) @@ -14,6 +13,5 @@ var me *mainType  // this app's variables  type mainType struct {  	argv *argvpb.Argv // shell autocomplete -	pp   *arg.Parser  // the go-arg parser of the command line  	gui  *gui.Node    // the gui toolkit handle  }  | 
