summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-03 01:05:35 -0500
committerJeff Carr <[email protected]>2025-10-03 01:05:35 -0500
commita9dd67b5b8d0fdea16de11bf33cdf2262ba72962 (patch)
treef32ef38a013164d7c4ea03c94fb03a8c8d9114a8
parent8c9a331c9b833e14fcbd381b8065d488d0d9fbf5 (diff)
work out better help interactions with go-args
-rw-r--r--auto.proto1
-rw-r--r--complete.go9
2 files changed, 7 insertions, 3 deletions
diff --git a/auto.proto b/auto.proto
index e041709..7a470ef 100644
--- a/auto.proto
+++ b/auto.proto
@@ -22,6 +22,7 @@ message Auto { // `autogenpb:marshal` `
bool debug = 12; // print debugging info if true
bool newline = 13; // was a newline was sent to STDERR?
string last = 14; // the last arg
+ repeated string goargs = 15; // what to send to alex flint's go-args for help
}
message Autos { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:nomutex`
diff --git a/complete.go b/complete.go
index 0a28981..2ebe8be 100644
--- a/complete.go
+++ b/complete.go
@@ -39,7 +39,9 @@ func (pb *Auto) doHandlePB() error {
// found.PrintDebug()
cmd := fmt.Sprintf("cmd='%s'", found.Cmd)
arglast := fmt.Sprintf("last='%s'", found.Last)
- pb.Debugf("AUTO HISTORY: age=%-6.6s %-18.18s %-18.18s partial='%s' argv='%v'", shell.FormatDuration(dur), cmd, arglast, found.Partial, found.Argv)
+ partial := fmt.Sprintf("p='%s'", found.Partial)
+ age := fmt.Sprintf("age='%-6.6s'", shell.FormatDuration(dur))
+ pb.Debugf("AUTO HISTORY: %s %-18.18s %-18.18s %-12.12s argv='%v' goargs='%v'", age, cmd, arglast, partial, found.Argv, found.Goargs)
last = found
}
}
@@ -83,8 +85,9 @@ func (pb *Auto) SubCommand(cmd ...string) {
partial := strings.Trim(pb.Partial, "'")
if pb.Debug {
if myAuto.examples == nil {
- log.Fprintf(os.Stderr, "\n")
- log.Fprintf(os.Stderr, "examples was nil\n")
+ pb.Debugf("WRITE DEBUG: argv.Examples() not defined")
+ // log.Fprintf(os.Stderr, "\n")
+ // log.Fprintf(os.Stderr, "examples was nil\n")
// log.Fprintf(os.Stderr, "\n")
} else {
log.Fprintf(os.Stderr, "\n")