Documentation ¶
Overview ¶
Package tabwriter provides a set of sane defaults for converting tab separated values into a pretty column formatted output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{
MinWidth: 5,
TabWidth: 0,
Padding: 2,
PadChar: ' ',
Flags: 0,
}
DefaultConfig is the tabwriter config that will be used if none is specified.
Functions ¶
func Format ¶
Format returns the input with the content aligned by tabs. If a config is specified it will be used otherwise DefaultConfig will be used.
func FormatWithHeader ¶
FormatWithHeader returns the input with the content aligned by tabs and includes a header even if no data is provided. If a config is specified it will be used otherwise DefaultConfig will be used.
Types ¶
type Config ¶
type Config struct { // MinWidth is the minimal cell width including any padding MinWidth int // TabWidth is the width of a tab characters (equivalent number of spaces) TabWidth int // Padding is added to a cell before computing its width Padding int // PadChar is an ASCII char used for padding; see more detail in // https://golang.org/pkg/text/tabwriter/#NewWriter PadChar byte // Flags specify formatting controls; see more detail in // https://golang.org/pkg/text/tabwriter/#pkg-constants Flags uint }
type TbnTabWriter ¶
type TbnTabWriter interface { // Format returns the input with the content aligned by tabs. Format(string) string // FormatWithHeader returns the input with the content aligned by tabs and // includes a header even if no data is provided. FormatWithHeader(string, string) string }
func New ¶
func New(cfg Config) TbnTabWriter
New constructs a new TbnTabWriter with the provided output config.
Click to show internal directories.
Click to hide internal directories.