summaryrefslogtreecommitdiff
path: root/argv.Print.go
diff options
context:
space:
mode:
Diffstat (limited to 'argv.Print.go')
-rw-r--r--argv.Print.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/argv.Print.go b/argv.Print.go
index 9429a01..7cfbcff 100644
--- a/argv.Print.go
+++ b/argv.Print.go
@@ -5,6 +5,7 @@ package argvpb
import (
"fmt"
+ "os"
"strings"
"go.wit.com/lib/cobol"
@@ -47,3 +48,26 @@ func (all *Argvs) PrintHistory() {
pb.PrintDebugNew("HIST")
}
}
+
+func (pb *Argv) PrintStderr() {
+ if !me.debug {
+ os.Exit(0)
+ }
+ lines := strings.Split(strings.TrimSpace(pb.Stderr), "\n")
+ if len(lines) == 0 {
+ os.Exit(0)
+ }
+ fmt.Fprintf(os.Stderr, "\n")
+ for _, line := range lines {
+ line = strings.TrimSpace(line)
+ if line == "" {
+ continue
+ }
+ fmt.Fprintf(os.Stderr, "%s\n", line)
+ }
+}
+
+func (pb *Argv) PrintStderrExit() {
+ pb.PrintStderr()
+ os.Exit(0)
+}