Compare commits

..

1 Commits

Author SHA1 Message Date
Jeff Carr 5e8fab62dc new argv bash completion 2025-09-25 02:30:52 -05:00
4 changed files with 18 additions and 18 deletions

23
argv.go
View File

@ -4,8 +4,9 @@
package main package main
import ( import (
"fmt"
"os" "os"
"go.wit.com/lib/gui/prep"
) )
/* /*
@ -58,17 +59,15 @@ regex -- interact with Googles' Gemini AI
handles shell autocomplete handles shell autocomplete
*/ */
func (a args) DoAutoComplete(argv []string) { func (args) Appname() string {
switch argv[0] { return ARGNAME
case "playback": }
fmt.Println("long --uuid purge last submit")
case "clean": func (a args) DoAutoComplete(pb *prep.Auto) {
fmt.Println("") if pb.Cmd == "" {
default: pb.Autocomplete3([]string{"--bash", "interact", "playback", "clean"})
if argv[0] == ARGNAME { } else {
// list the subcommands here pb.SubCommand(pb.Argv...)
fmt.Println("--json interact playback clean")
}
} }
os.Exit(0) os.Exit(0)
} }

4
build Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash -x
mkdir -p files/usr/share/bash-completion/completions/
regex --bash > files/usr/share/bash-completion/completions/regex

View File

@ -9,7 +9,6 @@ import (
"embed" "embed"
"github.com/google/uuid" "github.com/google/uuid"
"go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/gui/prep" "go.wit.com/lib/gui/prep"
"go.wit.com/lib/protobuf/chatpb" "go.wit.com/lib/protobuf/chatpb"
"go.wit.com/log" "go.wit.com/log"
@ -32,9 +31,8 @@ var configSave bool
func main() { func main() {
me = new(mainType) me = new(mainType)
prep.Bash(ARGNAME, argv.DoAutoComplete) // this line should be: prep.Bash(argv) me.myGui = prep.Gui() // prepares the GUI package for go-args
me.myGui = prep.Gui() // prepares the GUI package for go-args me.auto = prep.Bash3(&argv) // add support for bash autocomplete with go-arg
me.pp = arg.MustParse(&argv)
var err error var err error
// load the default chat protobuf // load the default chat protobuf

View File

@ -6,7 +6,6 @@ package main
import ( import (
"context" "context"
"go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/gadgets" "go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/prep" "go.wit.com/lib/gui/prep"
"go.wit.com/lib/protobuf/chatpb" "go.wit.com/lib/protobuf/chatpb"
@ -17,7 +16,7 @@ var me *mainType
// this app's variables // this app's variables
type mainType struct { type mainType struct {
pp *arg.Parser // for parsing the command line args. Yay to alexf lint! auto *prep.Auto // more experiments for bash handling
chats *chatpb.Chats // all our prior conversations with regex chats *chatpb.Chats // all our prior conversations with regex
client *genai.Client // the Google Gemini AI client variable client *genai.Client // the Google Gemini AI client variable
ctx context.Context // global context. what does this acutally mean? ctx context.Context // global context. what does this acutally mean?