diff options
Diffstat (limited to 'auto.Print.go')
| -rw-r--r-- | auto.Print.go | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/auto.Print.go b/auto.Print.go index 6c0d489..0fcdd8a 100644 --- a/auto.Print.go +++ b/auto.Print.go @@ -7,7 +7,6 @@ import ( "fmt" "os" "strings" - "time" "go.wit.com/lib/cobol" ) @@ -31,18 +30,27 @@ func (pb *Auto) Debugf(fmts string, parts ...any) { // print out auto complete debugging info func (pb *Auto) PrintDebug() { - dur := pb.Duration.AsDuration() - pb.Debugf("ARGV: 0='%s' 1='%s' p='%s' cmd='%s' age=(%s) argv=%v fast=%v\n", pb.Arg0, pb.Arg1, pb.Partial, pb.Cmd, cobol.FormatDuration(dur), pb.Argv, pb.Fast) + pb.PrintDebugNew("ARGV") } -func (pb *Autos) PrintHistory() { - for found := range pb.IterAll() { - cmd := fmt.Sprintf("cmd='%s'", found.Cmd) - arglast := fmt.Sprintf("last='%s'", found.Last) - partial := fmt.Sprintf("p='%s'", found.Partial) - dur := time.Since(found.Ctime.AsTime()) - age := fmt.Sprintf("age=(%s)", cobol.FormatDuration(dur)) - found.Debugf("HIST: %s %-18.18s %-18.18s %-12.12s argv='%v' fast=%v goargs='%v'", age, cmd, arglast, partial, found.Argv, found.Fast, found.Goargs) +func (pb *Auto) PrintDebugNew(msg string) { + cmd := fmt.Sprintf("cmd='%s'", pb.Cmd) + arglast := fmt.Sprintf("last='%s'", pb.Last) + partial := fmt.Sprintf("p='%s'", pb.Partial) + dur := cobol.Duration(pb.Ctime) + var fast string + if pb.Fast { + fast = "fast=1," + pb.Fastcmd + } else { + fast = "fast=0," + pb.Fastcmd + } + sargv := fmt.Sprintf("argv(%v)", pb.Argv) + pb.Debugf("%s: age=(%s) %-12.12s %-12.12s %-12.12s %s %s goargs='%v'", msg, dur, cmd, arglast, partial, fast, sargv, pb.Goargs) +} + +func (all *Autos) PrintHistory() { + for pb := range all.IterAll() { + pb.PrintDebugNew("HIST") } } |
