be2a61047c
This offloads the "magic numbers" that are used when creating a tabwriter
20 lines
457 B
Go
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)
|
|
}
|