table

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package table provides utilities for showing results in table format

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	// Limit is the number of rows to show in the result (table format only)
	Limit int
}

Option is the option used for table presenter.

type Presenter

type Presenter struct {
	// contains filtered or unexported fields
}

Presenter will show the analysis result in table format.

func NewPresenter

func NewPresenter(provider Provider, opts Option) *Presenter

NewPresenter will init a table presenter.

func (Presenter) Footer

func (p Presenter) Footer() string

Footer is the footer of the table output.

func (Presenter) Present

func (p Presenter) Present(output io.Writer) error

Present will convert the result into table format and pass to io.Writer.

func (Presenter) Title

func (p Presenter) Title() string

Title is the title of the table output.

type Provider

type Provider interface {
	Title() string
	Footer() string
	Header() []string
	Rows() [][]string
}

Provider implement the methods needed for creating table.

Jump to

Keyboard shortcuts

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