airshipctl/pkg/util/tabwriter.go
Ian Howell be2a61047c Move tabwriter to package util
This offloads the "magic numbers" that are used when creating a
tabwriter
2019-05-23 15:25:04 -05:00

20 lines
457 B
Go

package util
import (
"io"
"text/tabwriter"
)
const (
tabwriterMinWidth = 6
tabwriterWidth = 4
tabwriterPadding = 3
tabwriterPadChar = ' '
tabwriterFlags = 0
)
// NewTabWriter returns a tabwriter that translates tabbed columns in input into properly aligned text.
func NewTabWriter(out io.Writer) *tabwriter.Writer {
return tabwriter.NewWriter(out, tabwriterMinWidth, tabwriterWidth, tabwriterPadding, tabwriterPadChar, tabwriterFlags)
}