table

package
v0.5.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TableStyles = map[string]table.Style{
		"default": table.StyleDefault,
		"bold":    table.StyleBold,

		"bright":           table.StyleColoredBright,
		"dark":             table.StyleColoredDark,
		"black-on-blue":    table.StyleColoredBlackOnBlueWhite,
		"black-on-cyan":    table.StyleColoredBlackOnCyanWhite,
		"black-on-green":   table.StyleColoredBlackOnGreenWhite,
		"black-on-magenta": table.StyleColoredBlackOnMagentaWhite,
		"black-on-yellow":  table.StyleColoredBlackOnYellowWhite,
		"black-on-red":     table.StyleColoredBlackOnRedWhite,
		"blue-on-black":    table.StyleColoredBlueWhiteOnBlack,
		"cyan-on-black":    table.StyleColoredCyanWhiteOnBlack,
		"green-on-black":   table.StyleColoredGreenWhiteOnBlack,
		"magenta-on-black": table.StyleColoredMagentaWhiteOnBlack,
		"red-on-black":     table.StyleColoredRedWhiteOnBlack,
		"yellow-on-black":  table.StyleColoredYellowWhiteOnBlack,
		"double":           table.StyleDouble,
		"light":            table.StyleLight,
		"rounded":          table.StyleRounded,
	}
)

Functions

This section is empty.

Types

type BoxStyle added in v0.2.68

type BoxStyle struct {
	BottomLeft       string `yaml:"bottom-left,omitempty,flow"`
	BottomRight      string `yaml:"bottom-right,omitempty,flow"`
	BottomSeparator  string `yaml:"bottom-separator,omitempty,flow"`
	Left             string `yaml:"left,omitempty,flow"`
	LeftSeparator    string `yaml:"left-separator,omitempty,flow"`
	MiddleHorizontal string `yaml:"middle-horizontal,omitempty,flow"`
	MiddleSeparator  string `yaml:"middle-separator,omitempty,flow"`
	MiddleVertical   string `yaml:"middle-vertical,omitempty,flow"`
	PaddingLeft      string `yaml:"padding-left,omitempty,flow"`
	PaddingRight     string `yaml:"padding-right,omitempty,flow"`
	PageSeparator    string `yaml:"page-separator,omitempty,flow,flow"`
	Right            string `yaml:"right,omitempty,flow"`
	RightSeparator   string `yaml:"right-separator,omitempty,flow"`
	TopLeft          string `yaml:"top-left,omitempty,flow"`
	TopRight         string `yaml:"top-right,omitempty,flow"`
	TopSeparator     string `yaml:"top-separator,omitempty,flow"`
	UnfinishedRow    string `yaml:"unfinished-row,omitempty,flow"`
}

type Color added in v0.2.68

type Color string

type ColorOptions added in v0.2.68

type ColorOptions struct {
	IndexColumn  Colors `yaml:"index-column,omitempty"`
	Footer       Colors `yaml:"footer,omitempty"`
	Header       Colors `yaml:"header,omitempty"`
	Row          Colors `yaml:"row,omitempty"`
	RowAlternate Colors `yaml:"row-alternate,omitempty"`
}

type Colors added in v0.2.68

type Colors []Color

type FormatOptions added in v0.2.68

type FormatOptions struct {
	Footer string `yaml:"footer,omitempty,flow"`
	Header string `yaml:"header,omitempty,flow"`
	Row    string `yaml:"row,omitempty,flow"`
}

type Options added in v0.2.68

type Options struct {
	DrawBorder      bool `yaml:"draw-border,omitempty"`
	SeparateColumns bool `yaml:"separate-columns,omitempty"`
	SeparateFooter  bool `yaml:"separate-footer,omitempty"`
	SeparateHeader  bool `yaml:"separate-header,omitempty"`
	SeparateRows    bool `yaml:"separate-rows,omitempty"`
}

type OutputFormatter

type OutputFormatter struct {
	OutputFileTemplate  string
	OutputMultipleFiles bool
	TableFormat         string
	TableStyle          table.Style
	TableStyleFile      string
	OutputFile          string
	PrintTableStyle     bool
	// contains filtered or unexported fields
}

func NewOutputFormatter

func NewOutputFormatter(tableFormat string, opts ...OutputFormatterOption) *OutputFormatter

func (*OutputFormatter) Close added in v0.3.1

func (tof *OutputFormatter) Close(ctx context.Context, w io.Writer) error

func (*OutputFormatter) ContentType added in v0.2.84

func (tof *OutputFormatter) ContentType() string

func (*OutputFormatter) OutputRow added in v0.3.1

func (tof *OutputFormatter) OutputRow(ctx context.Context, row_ types.Row, w io.Writer) error

func (*OutputFormatter) OutputTable added in v0.3.1

func (tof *OutputFormatter) OutputTable(ctx context.Context, table_ *types.Table, w io.Writer) error

func (*OutputFormatter) RegisterRowMiddlewares added in v0.3.1

func (tof *OutputFormatter) RegisterRowMiddlewares(mw *middlewares.TableProcessor) error

func (*OutputFormatter) RegisterTableMiddlewares added in v0.3.1

func (tof *OutputFormatter) RegisterTableMiddlewares(mw *middlewares.TableProcessor) error

type OutputFormatterOption

type OutputFormatterOption func(*OutputFormatter)

func WithOutputFile

func WithOutputFile(outputFile string) OutputFormatterOption

func WithOutputFileTemplate

func WithOutputFileTemplate(outputFileTemplate string) OutputFormatterOption

func WithOutputMultipleFiles

func WithOutputMultipleFiles(outputMultipleFiles bool) OutputFormatterOption

func WithPrintTableStyle added in v0.2.68

func WithPrintTableStyle(printTableStyle bool) OutputFormatterOption

func WithTableStyle added in v0.2.68

func WithTableStyle(tableStyle string) OutputFormatterOption

func WithTableStyleFile added in v0.2.68

func WithTableStyleFile(tableStyleFile string) OutputFormatterOption

type Style added in v0.2.68

type Style struct {
	Name    string        `yaml:"name"`
	Box     BoxStyle      `yaml:"box"`
	Color   ColorOptions  `yaml:"color"`
	Format  FormatOptions `yaml:"format"`
	Options Options       `yaml:"options"`
	Title   TitleOptions  `yaml:"title"`
}

type TitleOptions added in v0.2.68

type TitleOptions struct {
	Align  string `yaml:"align,omitempty"`
	Colors Colors `yaml:"colors,omitempty"`
	Format string `yaml:"format,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL