mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
18 lines
332 B
Go
18 lines
332 B
Go
package common
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
"text/tabwriter"
|
|
)
|
|
|
|
func NewTabWriter(headers []string) (*tabwriter.Writer, error) {
|
|
writer := tabwriter.NewWriter(os.Stdout, 20, 2, 3, ' ', 0)
|
|
_, err := fmt.Fprintln(writer, strings.Join(headers, "\t"))
|
|
if err != nil {
|
|
return &tabwriter.Writer{}, err
|
|
}
|
|
return writer, nil
|
|
}
|