new autocomplete

This commit is contained in:
Jeff Carr 2025-09-25 01:09:41 -05:00
parent 8b199273e8
commit 5e60e8d76d
3 changed files with 29 additions and 9 deletions

View File

@ -1,5 +1,7 @@
VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
BUILDTIME = $(shell date +%s)
# VERSION = $(shell git describe --tags)
# BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
run: install
go-clone --version

20
argv.go
View File

@ -1,8 +1,9 @@
package main
import (
"fmt"
"os"
"go.wit.com/lib/gui/prep"
)
/*
@ -37,6 +38,7 @@ Examples:
`
}
/*
func (a args) DoAutoComplete(argv []string) {
switch argv[0] {
case "checkout":
@ -51,3 +53,19 @@ func (a args) DoAutoComplete(argv []string) {
}
os.Exit(0)
}
*/
func (args) Appname() string {
return ARGNAME
}
func (a args) DoAutoComplete(pb *prep.Auto) {
// fmt.Fprintf(os.Stderr, "blah\n")
// fmt.Fprintf(os.Stderr, "\n")
if pb.Cmd == "" {
pb.Autocomplete3([]string{"--dry-run", "--recursive", "--work"})
} else {
pb.SubCommand(pb.Argv...)
}
os.Exit(0)
}

14
main.go
View File

@ -3,7 +3,6 @@ package main
import (
"os"
"go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/gui/prep"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
@ -16,17 +15,18 @@ var BUILDTIME string
var ARGNAME string = "go-clone"
var pp *arg.Parser
// var pp *arg.Parser
var forge *forgepb.Forge
var auto *prep.Auto // more experiments for bash handling
var workingRepo *gitpb.Repo
func main() {
log.Info("go-clone version", VERSION, "built on", BUILDTIME)
// command line parsing & handling
prep.Bash(ARGNAME, argv.DoAutoComplete) // todo: make this: prep.Bash(argv)
pp = arg.MustParse(&argv)
// log.Info("go-clone version", VERSION, "built on", BUILDTIME)
// prep.Bash(ARGNAME, argv.DoAutoComplete) // todo: make this: prep.Bash(argv)
// pp = arg.MustParse(&argv)
// prep.Gui() // prepares the GUI package for go-args
auto = prep.Bash3(&argv) // this line should be: prep.Bash(&argv)
forge = forgepb.Init()