summaryrefslogtreecommitdiff
path: root/argv.Print.go
diff options
context:
space:
mode:
Diffstat (limited to 'argv.Print.go')
-rw-r--r--argv.Print.go52
1 files changed, 33 insertions, 19 deletions
diff --git a/argv.Print.go b/argv.Print.go
index 7c89404..db4d590 100644
--- a/argv.Print.go
+++ b/argv.Print.go
@@ -25,22 +25,16 @@ func Debugf(fmts string, parts ...any) {
// print out auto complete debugging info
func (pb *Argv) PrintDebug(last string) {
- pb.PrintDebugNew("ARGV", last)
+ pb.PrintDebugNew("ARGV", me.last)
}
-func (pb *Argv) PrintDebugNew(msg string, last string) {
+func (pb *Argv) PrintDebugNew(msg string, last *Argv) {
cmd := fmt.Sprintf("cmd='%s'", pb.GetCmd())
- var arglast string
- arglast = fmt.Sprintf("last='%s'", last)
+ // var arglast string
+ // arglast = fmt.Sprintf("last='%s'", last.GetCmd())
partial := fmt.Sprintf("p='%s'", pb.Partial)
age := cobol.Duration(pb.Ctime)
dur := cobol.Duration(pb.Duration)
- var fast string
- if pb.Fast {
- fast = "fast=1," + pb.GetCmd()
- } else {
- fast = "fast=0," + pb.GetCmd()
- }
var dbg string
if me.debug {
@@ -49,29 +43,49 @@ func (pb *Argv) PrintDebugNew(msg string, last string) {
dbg = "dbg=0"
}
sargv := fmt.Sprintf("argv(%v)", pb.Real)
- top := fmt.Sprintf("%-4.4s age=(%s)dur(%s) %s h%2d %-12.12s %-12.12s", pb.Uuid, age, dur, dbg, pb.HelpCounter, cmd, arglast)
- Debugf("%s: %s %-12.12s %s %s real='%v' len(%d)", msg, top, partial, fast, sargv, pb.Real, me.all.Len())
+ fast := fmt.Sprintf("F%-2dout%-2derr%-2d", pb.Fast, pb.OutCounter, pb.ErrCounter)
+ top := fmt.Sprintf("%-4.4s age=(%s)dur(%s) %s %s %-12.12s", pb.Uuid, age, dur, dbg, fast, cmd)
+ Debugf("%s: %s %-12.12s %s cmd=%s real='%v' len(%d)", msg, top, partial, pb.GetCmd(), sargv, pb.Real, me.all.Len())
}
-func (all *Argvs) PrintHistory(last string) {
+func (all *Argvs) PrintHistory(msg string) {
counter := 0
+ var last *Argv
+ // for pb := range all.Argv[0:10] {
for pb := range all.IterAll() {
counter += 1
- // hist := fmt.Sprintf("HIST(%d)", counter)
- hist := fmt.Sprintf("HIST")
- pb.PrintDebugNew(hist, last)
- if counter > 100 {
+ pb.PrintDebugNew(msg, last)
+ last = pb
+ if counter > 30 {
// sometimes I'm dumb
break
}
}
}
-func PrintStderr() {
+func PrintStddbg() {
if !me.debug {
return
}
- lines := strings.Split(strings.TrimSpace(PB.Stderr), "\n")
+ lines := strings.Split(strings.TrimSpace(PB.Stddbg), "\n")
+ if len(lines) == 0 {
+ return
+ }
+ fmt.Fprintf(os.Stderr, "\n")
+ for _, line := range lines {
+ fmt.Fprintf(os.Stderr, "%s\n", line)
+ }
+ fmt.Fprintf(os.Stderr, "\n")
+}
+
+func PrintStderr() {
+ var lines []string
+ for _, line := range strings.Split(strings.TrimSpace(PB.Stderr), "\n") {
+ if strings.TrimSpace(line) == "" {
+ continue
+ }
+ lines = append(lines, line)
+ }
if len(lines) == 0 {
return
}