summaryrefslogtreecommitdiff
path: root/theMagicOfAutocomplete.go
diff options
context:
space:
mode:
Diffstat (limited to 'theMagicOfAutocomplete.go')
-rw-r--r--theMagicOfAutocomplete.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/theMagicOfAutocomplete.go b/theMagicOfAutocomplete.go
index ae0888d..2b345a4 100644
--- a/theMagicOfAutocomplete.go
+++ b/theMagicOfAutocomplete.go
@@ -1,4 +1,4 @@
-package prep
+package argvpb
// This is where the actual autocomplete happens
// lots of the fun magic is in here
@@ -15,7 +15,7 @@ import (
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
)
-func Autocomplete(dest any) *Auto {
+func Autocomplete(dest any) *Argv {
me = new(AutoArgs) // todo: redo this
findAppInfo(dest) // parses back to main() for argv info
@@ -32,10 +32,10 @@ func Autocomplete(dest any) *Auto {
me.pb = parseArgv(me.ARGNAME)
// the argv history
- all := NewAutos()
+ all := NewArgvs()
// initializes the application config file
- config.Init(me.ARGNAME, me.VERSION, me.BUILDTIME, me.pb.Argv)
+ config.Init(me.ARGNAME, me.VERSION, me.BUILDTIME, me.pb.Real)
// loads the autocomplete history file
err := config.LoadCache(all, "argv", me.ARGNAME) //
@@ -78,7 +78,7 @@ func Autocomplete(dest any) *Auto {
// set the duration since the last auto complete
// find the last entry. this is dumb way to do it
- last := new(Auto)
+ last := new(Argv)
last.Ctime = timestamppb.New(time.Now().Add(-time.Second))
for found := range all.IterAll() {
last = found
@@ -95,7 +95,7 @@ func Autocomplete(dest any) *Auto {
// roll the autocomplete file
if all.Len() > 15 {
me.pb.Debugf("DEBUG: trim() history is over 100 len=%d vs new=%d", all.Len(), all.Len()-90)
- all.Autos = all.Autos[all.Len()-10:]
+ all.Argvs = all.Argvs[all.Len()-10:]
// newall.Autos = all.Autos[0:10]
// for _, found := range all.Autos[0:10] {
// newall.Append(found)
@@ -118,7 +118,7 @@ func Autocomplete(dest any) *Auto {
}
flags := []string{}
- for _, s := range me.pb.Argv {
+ for _, s := range me.pb.Real {
if s == "--autodebug" {
continue
}
@@ -174,7 +174,7 @@ func Autocomplete(dest any) *Auto {
}
if me.autoFunc == nil {
- me.pb.SubCommand(me.pb.Argv...)
+ me.pb.SubCommand(me.pb.Real...)
} else {
me.autoFunc(me.pb) // run the autocomplete function the user made for their application
}