summaryrefslogtreecommitdiff
path: root/argv.Print.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-28 23:42:23 -0500
committerJeff Carr <[email protected]>2025-10-28 23:42:23 -0500
commitbca3f42ae8ddf7e56c93a143b915a8dc9f3326f4 (patch)
tree3f0cab09e18401b79c26e1b46acfdf80b141577b /argv.Print.go
parent6b78f1857fe35d39bfef3e5e8a03cbd0e71fa169 (diff)
rename now that things are getting cleaner
Diffstat (limited to 'argv.Print.go')
-rw-r--r--argv.Print.go134
1 files changed, 0 insertions, 134 deletions
diff --git a/argv.Print.go b/argv.Print.go
deleted file mode 100644
index 49b1089..0000000
--- a/argv.Print.go
+++ /dev/null
@@ -1,134 +0,0 @@
-package argvpb
-
-// debug argv protobuf functions
-// enable with --autodebug or Setenv( "AUTOCOMPLETE_VERBOSE" )
-
-import (
- "fmt"
- "os"
- "strings"
-
- "go.wit.com/lib/cobol"
- "go.wit.com/lib/config"
-)
-
-func (pb *Argv) debugf(fmts string, parts ...any) {
- debugf(fmts, parts...)
-}
-
-// decides here to print to STDERR or not
-func debugf(fmts string, parts ...any) {
- fmts = strings.TrimSpace(fmts)
- fmts += "\n"
- // me.pb.Stderr += fmt.Sprintf(fmts, parts...)
- fmt.Fprintf(Stddbg, fmts, parts...)
-}
-
-// print out auto complete debugging info
-func (pb *Argv) printDebug(last string) {
- pb.printDebugNew("ARGV", me.last)
-}
-
-func (pb *Argv) printDebugNew(msg string, last *Argv) {
- // var arglast string
- // arglast = fmt.Sprintf("last='%s'", last.GetCmd())
- partial := fmt.Sprintf("p='%s'", pb.Partial)
- age := cobol.Duration(pb.Ctime)
- pdur := cobol.Duration(pb.Duration)
- argvdur := cobol.Duration(pb.ArgvDuration)
-
- var dbg string
- if me.debug {
- dbg = "dbg=1"
- } else {
- dbg = "dbg=0"
- }
- lens := fmt.Sprintf("len=%-2d,%-2d,%-2d", me.all.Len(), len(strings.Fields(pb.Stdout)), len(strings.Split(pb.Stderr, "\n")))
- fast := fmt.Sprintf("F%-2dout%-2derr%-2d %s", pb.Fast, pb.OutCounter, pb.ErrCounter, lens)
- top := fmt.Sprintf("%-4.4s age=(%s)(%s)dur(%s) %s %s cmd=%-12.12s", pb.Uuid, age, pdur, argvdur, dbg, fast, pb.GetCmd())
- debugf("%s: %s %-12.12s real='%v'", msg, top, partial, pb.Real)
-}
-
-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
- pb.printDebugNew(msg, last)
- last = pb
- if counter > 30 {
- // sometimes I'm dumb
- break
- }
- }
-}
-
-func printStddbg() {
- if !me.debug {
- return
- }
- if config.Exists("/tmp/argv.debug") {
- printStddbgFile()
- return
- }
- 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 printStddbgFile() {
- if !me.debug {
- return
- }
- f, err := os.OpenFile("/tmp/argv.debug", os.O_APPEND|os.O_RDWR|os.O_CREATE, 0644)
- if err != nil {
- return
- }
- defer f.Close()
- lines := strings.Split(strings.TrimSpace(PB.Stddbg), "\n")
- if len(lines) == 0 {
- return
- }
- fmt.Fprintf(f, "\n")
- for _, line := range lines {
- fmt.Fprintf(f, "%s\n", line)
- }
- fmt.Fprintf(f, "\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
- }
- fmt.Fprintf(os.Stderr, "\n")
- for _, line := range lines {
- // line = strings.TrimSpace(line)
- // if line == "" {
- // continue
- // }
- fmt.Fprintf(os.Stderr, "%s\n", line)
- }
- fmt.Fprintf(os.Stderr, "\n")
-}
-
-func printStdout() {
- line := strings.TrimSpace(PB.Stdout)
- if line == "" {
- return
- }
- fmt.Fprintf(os.Stdout, " %s\n", line)
-}