summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--formatTime.go3
-rw-r--r--humanTable.go5
2 files changed, 6 insertions, 2 deletions
diff --git a/formatTime.go b/formatTime.go
index 6956ecc..dc2e6c5 100644
--- a/formatTime.go
+++ b/formatTime.go
@@ -3,6 +3,7 @@ package cobol
// time is relative. keep it that way.
import (
+ "fmt"
"time"
)
@@ -12,7 +13,7 @@ func FormatTime(t time.Time) string {
s := t.UTC().Format("2006/01/02 15:04:03")
dur := time.Since(t)
//always time, two spaces, (duration)
- return s + " (" + FormatDuration(dur) + ")"
+ return fmt.Sprintf("%s (%-5.5s)", s, FormatDuration(dur))
}
func FormatTimeLocal(t time.Time) string {
diff --git a/humanTable.go b/humanTable.go
index caf0bba..70f94aa 100644
--- a/humanTable.go
+++ b/humanTable.go
@@ -30,7 +30,10 @@ func StandardTableRow(sizes []int, args []string) (string, string) {
}
fmts = append(fmts, sfmt)
if len(args) > i {
- val := strings.Join(strings.Fields(args[i]), " ") // removes all newlines
+ val := strings.ReplaceAll(args[i], "\r", "")
+ val = strings.ReplaceAll(val, "\n", "")
+ // removes newlines but squashes spaces (which is bad)
+ // val := strings.Join(strings.Fields(args[i]), " ")
cell = fmt.Sprintf(sfmt, val)
parts = append(parts, cell)
} else {