summaryrefslogtreecommitdiff
path: root/argv.Print.go
diff options
context:
space:
mode:
Diffstat (limited to 'argv.Print.go')
-rw-r--r--argv.Print.go26
1 files changed, 10 insertions, 16 deletions
diff --git a/argv.Print.go b/argv.Print.go
index 68e79d1..9429a01 100644
--- a/argv.Print.go
+++ b/argv.Print.go
@@ -5,7 +5,6 @@ package argvpb
import (
"fmt"
- "os"
"strings"
"go.wit.com/lib/cobol"
@@ -15,17 +14,7 @@ import (
func (pb *Argv) Debugf(fmts string, parts ...any) {
fmts = strings.TrimSpace(fmts)
fmts += "\n"
- // NOTE: env doesn't work probably most (all?) the time because bash
- // doesn't send all the ENV to autocomplete. so, trap on a "--autodebug" command line arg
- if os.Getenv("AUTOCOMPLETE_VERBOSE") == "true" || pb.Debug {
- if !pb.Newline {
- fmt.Fprintf(os.Stderr, "\n")
- pb.Newline = true
- }
- fmt.Fprintf(os.Stderr, fmts, parts...)
- } else {
- // fmt.Fprintf(os.Stderr, "NOT DOING ANYTHING\n")
- }
+ pb.Stderr += fmt.Sprintf(fmts, parts...)
}
// print out auto complete debugging info
@@ -34,15 +23,20 @@ func (pb *Argv) PrintDebug() {
}
func (pb *Argv) PrintDebugNew(msg string) {
- cmd := fmt.Sprintf("cmd='%s'", pb.Cmd)
- arglast := fmt.Sprintf("last='%s'", pb.Last)
+ cmd := fmt.Sprintf("cmd='%s'", pb.GetCmd())
+ var arglast string
+ if me.last == nil {
+ arglast = fmt.Sprintf("last='%s'", "<nil>")
+ } else {
+ arglast = fmt.Sprintf("last='%s'", me.last.GetCmd())
+ }
partial := fmt.Sprintf("p='%s'", pb.Partial)
dur := cobol.Duration(pb.Ctime)
var fast string
if pb.Fast {
- fast = "fast=1," + pb.Fastcmd
+ fast = "fast=1," + pb.GetCmd()
} else {
- fast = "fast=0," + pb.Fastcmd
+ fast = "fast=0," + pb.GetCmd()
}
sargv := fmt.Sprintf("argv(%v)", pb.Real)
pb.Debugf("%s: age=(%s) %-12.12s %-12.12s %-12.12s %s %s goargs='%v'", msg, dur, cmd, arglast, partial, fast, sargv, pb.Goargs)