diff options
| author | Jeff Carr <[email protected]> | 2025-10-17 09:41:12 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-17 09:41:12 -0500 |
| commit | 9ab7015f12dcf2d629dd878a845dd29708f980ff (patch) | |
| tree | c66c5c26c6815627e6824baac2f0de8d2bddf60d | |
| parent | 99b510e5811290dd1d788a65f43af341c7361c51 (diff) | |
probably enough house cleaning. now to think.
| -rw-r--r-- | argv.LoadHistory.go | 28 | ||||
| -rw-r--r-- | generate.go | 1 | ||||
| -rw-r--r-- | structs.go | 44 | ||||
| -rw-r--r-- | theMagicOfAutocomplete.go | 8 |
4 files changed, 13 insertions, 68 deletions
diff --git a/argv.LoadHistory.go b/argv.LoadHistory.go deleted file mode 100644 index a66758c..0000000 --- a/argv.LoadHistory.go +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT. -// go install go.wit.com/apps/autogenpb@latest -// -// This file was autogenerated with autogenpb: -// autogenpb v0.5.27 Built on 2025/10/16 17:13:05 ( 50 m) -// Theese sort.pb.go and marshal.pb.go files are autogenerated -// The autogenpb sources have example .proto files with instructions -// - -package argvpb - -import ( - "errors" - - "go.wit.com/lib/config" -) - -// deletes and remakes the PB file when .proto versions change -func (pb *Argvs) LoadSafe() error { - err := config.LoadPB(pb) - if errors.Is(err, config.VersionMismatch) { - panic("fixme in autopb") - // TODO: erase and recreate the PB file - } else if err != nil { - panic("still fixme in") - } - return err -} diff --git a/generate.go b/generate.go index a68b4e6..f539638 100644 --- a/generate.go +++ b/generate.go @@ -6,5 +6,4 @@ package argvpb // // NOTE: please add to go generate: if ! exists go.mod, run 'go mod init' & 'go mod tidy' // -//go:generate make go-generate //go:generate autogenpb --proto auto.proto @@ -1,60 +1,26 @@ package argvpb -// initializes logging and command line options - import ( - "strings" - "go.wit.com/dev/alexflint/arg" ) -/* -This struct can be used with the go-arg package. These -are the generic default command line arguments for the 'GUI' package -*/ -var argBash ArgsBash - -type ArgsBash struct { - Bash bool `arg:"--bash" help:"generate bash completion"` -} - -// returns the name of the executable registered for shell autocomplete -func AppName() string { - return me.ARGNAME -} - // try this struct out (?) var me *AutoArgs // this is a work in progress type AutoArgs struct { + pb *Argv // the protobuf for the current process + pp *arg.Parser // for parsing the command line args. Yay to alexf lint! id int // should be unique - hidden bool // don't update the toolkits when it's hidden Argv func([]string) // the function for shell autocomplete examples func() string // some examples appExit func() // app Exit() buildtime func() (string, string) // some examples - pp *arg.Parser // for parsing the command line args. Yay to alexf lint! autoFunc func(*Argv) // also a function for autocomplete guiFunc func() error // enables Gui functions - err error // store any errors from argv - pb *Argv - - ARGNAME string // a good way to track the name of the binary ? + ARGNAME string // a good way to track the name of the binary ? VERSION string BUILDTIME string -} - -// returns the last command (is blank if the current arg is not blank) -func GetLast(cur string, argv []string) string { - if cur != "''" { - return "" - } - for _, s := range argv { - if strings.HasPrefix(s, "-") { - continue - } - return s - } - return "" + err error // store any errors from argv + // hidden bool // don't update the toolkits when it's hidden } diff --git a/theMagicOfAutocomplete.go b/theMagicOfAutocomplete.go index a5516d2..902f1ea 100644 --- a/theMagicOfAutocomplete.go +++ b/theMagicOfAutocomplete.go @@ -15,6 +15,14 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" ) +// this is sill in development +// figure out how to trigger this +var argBash ArgsBash + +type ArgsBash struct { + Bash bool `arg:"--bash" help:"generate bash completion"` +} + func Autocomplete(dest any) *Argv { me = new(AutoArgs) // todo: redo this findAppInfo(dest) // parses back to main() for argv info |
