From 5e60e8d76d84e8c58cc070102fb4fd8848159a24 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 25 Sep 2025 01:09:41 -0500 Subject: new autocomplete --- Makefile | 4 +++- argv.go | 20 +++++++++++++++++++- main.go | 14 +++++++------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 4a4ed25..f91b50a 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/argv.go b/argv.go index 076fc2b..8089cc8 100644 --- a/argv.go +++ b/argv.go @@ -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) +} diff --git a/main.go b/main.go index cad220e..1a4fd50 100644 --- a/main.go +++ b/main.go @@ -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() -- cgit v1.2.3