diff options
| author | Jeff Carr <[email protected]> | 2025-10-26 10:17:14 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-26 10:17:14 -0500 |
| commit | d8451d71898fb96dd096a9d560f36ad52d460726 (patch) | |
| tree | 86b55b0b7281f9e4308e23c71c6a7e89721454f4 /complete.go | |
| parent | 163590b99a4e36d6113fe40c426f8633aec68d33 (diff) | |
newer better argvv0.0.34
Diffstat (limited to 'complete.go')
| -rw-r--r-- | complete.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/complete.go b/complete.go new file mode 100644 index 0000000..69a1d0c --- /dev/null +++ b/complete.go @@ -0,0 +1,48 @@ +// Copyright 2017-2025 WIT.COM Inc. All rights reserved. +// Use of this source code is governed by the GPL 3.0 + +package main + +import ( + "fmt" + "strings" + + "go.wit.com/dev/alexflint/arg" + "go.wit.com/lib/protobuf/argvpb" +) + +// sent via -ldflags +var VERSION string +var BUILDTIME string + +// used for shell auto completion +var APPNAME string = "regex" + +func (a args) Description() string { + return ` +regex -- interact with Googles' Gemini AI + ` +} + +func (args) MustParse() error { + me.pp = arg.MustParse(&argv) + return nil +} + +// sends the strings to bash or zsh that will be your options +func (a args) DoAutoComplete() error { + if argvpb.PB.GetCmd() == "" { + matches := []string{"--bash", "interact", "playback", "clean", "--version"} + fmt.Fprintf(argvpb.Stdout, " %s", strings.Join(matches, " ")) + return nil + } + var err error + if me.pp == nil { + me.pp, err = arg.ParseFlagsArgv(&argv) + if err != nil { + return err + } + } + err = me.pp.WriteHelpForAutocomplete(argvpb.PB.Partial, argvpb.PB.Real...) + return err +} |
