diff options
| author | Jeff Carr <[email protected]> | 2025-10-24 02:36:45 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-24 02:36:45 -0500 |
| commit | 41cf7c3c4ca2fbfca7f9c2328e6f4e0ac34661d9 (patch) | |
| tree | 69c6e3329cd6f14b987fb5403206e9b7773d32b0 /theMagicOfAutocomplete.go | |
| parent | 3d0d7fa233f712c1c57b3b3092dece6f746f0f03 (diff) | |
try setting ENV globals for "--" args
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 |
