Replace olekukonko/tablewriter with cheynewallace/tabby

- Closes #1497
- Closes #1498

This library is simpler and doesn't produce extraneous whitespace around
the output.

A local helper function restores "--" for empty output.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-11-07 16:17:40 -07:00
parent 3cbb295e7b
commit a8554b0af5
11 changed files with 194 additions and 168 deletions

View File

@@ -0,0 +1,24 @@
package table
import (
"io"
"text/tabwriter"
"github.com/cheynewallace/tabby"
)
func Prep(parts []string) []interface{} {
args := make([]interface{}, len(parts))
for i, v := range parts {
if v == "" {
args[i] = "--"
} else {
args[i] = v
}
}
return args
}
func New(writer io.Writer) *tabby.Tabby {
return tabby.NewCustom(tabwriter.NewWriter(writer, 0, 0, 2, ' ', 0))
}