diff options
Diffstat (limited to 'theMagicOfAutocomplete.go')
| -rw-r--r-- | theMagicOfAutocomplete.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/theMagicOfAutocomplete.go b/theMagicOfAutocomplete.go index 3bc32f0..3f2311f 100644 --- a/theMagicOfAutocomplete.go +++ b/theMagicOfAutocomplete.go @@ -5,6 +5,7 @@ package argvpb import ( "errors" + "fmt" "os" "strings" "time" @@ -34,7 +35,7 @@ func Autocomplete(dest any) *Argv { initAppname() // parses os.Args into the protobuf - me.pb.parseArgv() + me.pb.parseOsArgs() // initializes the lib/ENV library ENV.Init(me.pb.AppInfo.APPNAME, me.pb.AppInfo.VERSION, cobol.Time(me.pb.AppInfo.BUILDTIME), me.pb.Real, GoodExit, BadExit) @@ -69,6 +70,13 @@ func Autocomplete(dest any) *Argv { os.Exit(0) } + ENV.SetGlobal("argv", "real", fmt.Sprintf("%v", me.pb.Real)) + for _, a := range me.pb.Real { + if strings.HasPrefix(a, "--") { + ENV.SetGlobal("argv", a, "true") + } + } + // not autocompleting. return go-arg & the application if !me.pb.IsAuto { // save the pb & history |
