summaryrefslogtreecommitdiff
path: root/argv.custom.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-25 19:33:05 -0500
committerJeff Carr <[email protected]>2025-10-25 19:33:05 -0500
commit36704585078a84db0a184f38456ec80cc3f6fcb1 (patch)
tree23a941d0316c92e094199b8a8811fa898d6bb7ee /argv.custom.go
parentfd6c04fec50fb083549b1c55f66f5279a7bdf468 (diff)
more progress
Diffstat (limited to 'argv.custom.go')
-rw-r--r--argv.custom.go27
1 files changed, 17 insertions, 10 deletions
diff --git a/argv.custom.go b/argv.custom.go
index 9525e82..0184c92 100644
--- a/argv.custom.go
+++ b/argv.custom.go
@@ -5,9 +5,9 @@ package main
import (
"fmt"
- "os"
"strings"
+ "go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/fhelp"
@@ -86,12 +86,12 @@ func (c CleanCmd) Match(partial string) []string {
// sends the strings to bash or zsh that will be your options
func (a args) SendCompletionStrings(pb *argvpb.Argv) {
if pb.IsMatch("mode.config") {
- pb.SendStrings([]string{"mine", "favorites"})
- os.Exit(0)
+ matches := []string{"mine", "favorites"}
+ fmt.Fprintf(argvpb.Stdout, strings.Join(matches, " "))
}
if pb.IsMatch("mode") {
- pb.SendStrings([]string{"once", "many", "mine", "favorites"})
- os.Exit(0)
+ matches := []string{"once", "many", "mine", "favorites"}
+ fmt.Fprintf(argvpb.Stdout, strings.Join(matches, " "))
}
if pb.GetCmd() == "" {
// these are base autocomplete strings
@@ -99,10 +99,17 @@ func (a args) SendCompletionStrings(pb *argvpb.Argv) {
matches = append(matches, "show", "add", "fixer", "dev", "verify", "mode", "gui", "whatchanged")
matches = append(matches, "--version", "--force", "--all")
fmt.Fprintf(argvpb.Stdout, strings.Join(matches, " "))
- // pb.SendStrings(matches)
- } else {
- // autogenerate the strings for the subcommand using github.com/alexflint/go-arg
- pb.GenerateSubCommandStrings(pb.Real...)
+ return
+ }
+ var err error
+ if me.pp == nil {
+ me.pp, err = arg.ParseFlagsArgv(&argv)
+ fmt.Fprintf(argvpb.Stderr, "returned from parseFlagsArgv(%v)\n", err)
}
- // os.Exit(0)
+ // matches := []string{"show", "repos"}
+ // err = me.pp.WriteHelpForAutocomplete(argvpb.PB.Partial, matches...)
+ // fmt.Fprintf(argvpb.Stderr, "returned from WriteHelpForAutocomplete() matches(%v)\n", matches)
+ err = me.pp.WriteHelpForAutocomplete(argvpb.PB.Partial, argvpb.PB.Real...)
+ fmt.Fprintf(argvpb.Stderr, "returned from WriteHelpForAutocomplete() pb.Real(%v)\n", pb.Real)
+ fmt.Fprintf(argvpb.Stderr, "returned from WriteHelpForAutocomplete(%v)\n", err)
}