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:
24
internal/app/wwctl/table/table.go
Normal file
24
internal/app/wwctl/table/table.go
Normal 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))
|
||||
}
|
||||
Reference in New Issue
Block a user