From 28839452b290b83d409193044c5737a92cc1ec3e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 16 Oct 2025 12:13:45 -0500 Subject: hmm --- Makefile | 6 +++--- dryrun.go | 2 +- structs.go | 18 +++++++++--------- theMagicOfAutocomplete.go | 3 ++- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 2f87593..a91c8be 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ -all: auto.pb.go goimports vet +all: proto vet @echo This GO code passes the compile checks -auto.pb.go: auto.proto - make generate +proto: + autogenpb --proto auto.proto generate: clean go mod init diff --git a/dryrun.go b/dryrun.go index e8e36bd..037f0a9 100644 --- a/dryrun.go +++ b/dryrun.go @@ -1,6 +1,6 @@ package prep -// initializes logging and command line options +// think about using something like this func DryRun() bool { return false diff --git a/structs.go b/structs.go index 31b7cc4..2594094 100644 --- a/structs.go +++ b/structs.go @@ -18,21 +18,26 @@ 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 { - id int // should be unique - hidden bool // don't update the toolkits when it's hidden - Auto func([]string) // the function for shell autocomplete + id int // should be unique + // hidden bool // don't update the toolkits when it's hidden + Auto 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(*Auto) // also a function for autocomplete guiFunc func() error // enables Gui functions err error // store any errors from argv + pp *arg.Parser // for parsing the command line args. Yay to alexf lint! pb *Auto ARGNAME string // a good way to track the name of the binary ? @@ -53,8 +58,3 @@ func GetLast(cur string, argv []string) string { } return "" } - -// returns the name of the executable registered for shell autocomplete -func AppName() string { - return me.ARGNAME -} diff --git a/theMagicOfAutocomplete.go b/theMagicOfAutocomplete.go index 7fddb00..ae0888d 100644 --- a/theMagicOfAutocomplete.go +++ b/theMagicOfAutocomplete.go @@ -15,11 +15,11 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" ) -// TODO: rename 'all' to 'pb' and 'pb' to 'pbnew' or 'pbcur' func Autocomplete(dest any) *Auto { me = new(AutoArgs) // todo: redo this findAppInfo(dest) // parses back to main() for argv info + // todo: figure this out if me.guiFunc != nil { // register gui args me.guiFunc() @@ -42,6 +42,7 @@ func Autocomplete(dest any) *Auto { if err != nil { // there is no history. // todo: initialize the history file + // todo: check if this is automatically done already } // set the start time of the binary -- cgit v1.2.3